Create a deep copy of a json_value linked-list structure.
program test use json_module implicit none type(json_core) :: json type(json_value),pointer :: j1, j2 call json%parse('../files/inputs/test1.json',j1) call json%clone(j1,j2) !now have two independent copies call json%destroy(j1) !destroys j1, but j2 remains call json%print(j2,'j2.json') call json%destroy(j2) end program test
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | pointer | :: | from | this is the structure to clone |
||
type(json_value), | pointer | :: | to | the clone is put here (it must not already be associated) |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
subroutine json_clone(json,from,to)
implicit none
class(json_core),intent(inout) :: json
type(json_value),pointer :: from !! this is the structure to clone
type(json_value),pointer :: to !! the clone is put here
!! (it must not already be associated)
!call the main function:
! [note: this is not part of json_core class]
call json_value_clone_func(from,to)
end subroutine json_clone