json_file_move_pointer Subroutine

private subroutine json_file_move_pointer(to, from)

Move the json_value pointer from one json_file to another. The “from” pointer is then nullified, but not destroyed.

Note

If “from%p” is not associated, then an error is thrown.

Type Bound

json_file

Arguments

Type IntentOptional Attributes Name
class(json_file), intent(inout) :: to
class(json_file), intent(inout) :: from

Calls

proc~~json_file_move_pointer~~CallsGraph proc~json_file_move_pointer json_file_module::json_file%json_file_move_pointer none~initialize~2 json_file_module::json_file%initialize proc~json_file_move_pointer->none~initialize~2 none~throw_exception json_value_module::json_core%throw_exception proc~json_file_move_pointer->none~throw_exception proc~json_file_failed json_file_module::json_file%json_file_failed proc~json_file_move_pointer->proc~json_file_failed proc~initialize_json_core_in_file json_file_module::json_file%initialize_json_core_in_file none~initialize~2->proc~initialize_json_core_in_file proc~set_json_core_in_file json_file_module::json_file%set_json_core_in_file none~initialize~2->proc~set_json_core_in_file proc~json_throw_exception json_value_module::json_core%json_throw_exception none~throw_exception->proc~json_throw_exception proc~json_failed json_value_module::json_core%json_failed proc~json_file_failed->proc~json_failed proc~json_initialize json_value_module::json_core%json_initialize proc~initialize_json_core_in_file->proc~json_initialize proc~json_initialize->none~throw_exception proc~integer_to_string json_string_utilities::integer_to_string proc~json_initialize->proc~integer_to_string proc~json_clear_exceptions json_value_module::json_core%json_clear_exceptions proc~json_initialize->proc~json_clear_exceptions

Source Code

    subroutine json_file_move_pointer(to,from)

    implicit none

    class(json_file),intent(inout) :: to
    class(json_file),intent(inout) :: from

    if (associated(from%p)) then

        if (from%failed()) then
            !Don't get the data if the FROM file has an
            !active exception, since it may not be valid.
            call to%core%throw_exception('Error in json_file_move_pointer: '//&
                                         'error exception in FROM file.')
        else
            call to%initialize()  !initialize and clear any exceptions that may be present
            to%p => from%p
            nullify(from%p)
        end if

    else
        call to%core%throw_exception('Error in json_file_move_pointer: '//&
                                     'pointer is not associated.')
    end if

    end subroutine json_file_move_pointer