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%json_file_move_pointer none~initialize json_file%initialize proc~json_file_move_pointer->none~initialize none~throw_exception json_core%throw_exception proc~json_file_move_pointer->none~throw_exception proc~json_file_failed json_file%json_file_failed proc~json_file_move_pointer->proc~json_file_failed proc~initialize_json_core_in_file json_file%initialize_json_core_in_file none~initialize->proc~initialize_json_core_in_file proc~set_json_core_in_file json_file%set_json_core_in_file none~initialize->proc~set_json_core_in_file proc~json_throw_exception json_core%json_throw_exception none~throw_exception->proc~json_throw_exception proc~wrap_json_throw_exception json_core%wrap_json_throw_exception none~throw_exception->proc~wrap_json_throw_exception proc~json_failed json_core%json_failed proc~json_file_failed->proc~json_failed proc~json_initialize json_core%json_initialize proc~initialize_json_core_in_file->proc~json_initialize proc~wrap_json_throw_exception->none~throw_exception interface~to_unicode to_unicode proc~wrap_json_throw_exception->interface~to_unicode proc~to_uni to_uni interface~to_unicode->proc~to_uni proc~to_uni_vec to_uni_vec interface~to_unicode->proc~to_uni_vec proc~json_initialize->none~throw_exception proc~integer_to_string integer_to_string proc~json_initialize->proc~integer_to_string proc~json_clear_exceptions 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