json_file_valid_path_op Function

private function json_file_valid_path_op(path, me) result(found)

A wrapper for json_file_valid_path for the .in. operator

Arguments

Type IntentOptional AttributesName
character(kind=CK,len=*), intent(in) :: path

the path to the variable

class(json_file), intent(in) :: me

the JSON file

Return Value logical(kind=LK)

if the variable was found


Contents


Source Code

    function json_file_valid_path_op(path,me) result(found)

    implicit none

    character(kind=CK,len=*),intent(in) :: path   !! the path to the variable
    class(json_file),intent(in)         :: me     !! the JSON file
    logical(LK)                         :: found  !! if the variable was found

    type(json_core) :: core_copy !! a copy of `core` from `me`

    ! This is sort of a hack. Since `me` has to have `intent(in)`
    ! for the operator to work, we need to make a copy of `me%core`
    ! so we can call the low level routine (since it needs it to
    ! be `intent(inout)`) because it's technically possible for this
    ! function to raise an exception. This normally should never
    ! happen here unless the JSON structure is malformed.

    core_copy = me%core ! copy the settings (need them to know
                        ! how to interpret the path)

    found = core_copy%valid_path(me%p, path) ! call the low-level routine

    call core_copy%destroy() ! just in case (but not really necessary)

    end function json_file_valid_path_op