Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(json_value), | , | pointer | :: | me | ||
type(json_value), | , | pointer | :: | member | the child member to add |
Adds "member" as a child of "me".
Solid arrows point from a parent (sub)module to the submodule which is descended from it. Dashed arrows point from a module being used to the module using it.
Solid arrows point from one derived type to another which extends (inherits from) it. Dashed arrows point from a derived type to another type containing it as a components, with a label listing the name(s) of said component(s).
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.
subroutine json_value_add_member(me, member)
implicit none
type(json_value),pointer :: me
type(json_value),pointer :: member !! the child member to add
if (.not. exception_thrown) then
! associate the parent
member%parent => me
! add to linked list
if (associated(me%children)) then
me%tail%next => member
member%previous => me%tail
else
me%children => member
member%previous => null() !first in the list
end if
! new member is now the last one in the list
me%tail => member
me%n_children = me%n_children + 1
end if
end subroutine json_value_add_member