private subroutine json_get_array_with_path(me, path, array_callback, found)
Arguments
Type |
Intent | Optional |
Attributes | | Name | |
type(json_value), |
intent(in), |
|
pointer | :: |
me | |
character(kind=CK,len=*), |
intent(in) |
|
| :: |
path | |
procedure(array_callback_func), |
intent(inout) |
|
| :: |
array_callback | |
logical(kind=LK), |
intent(out), |
optional |
| :: |
found | |
Description
This routine calls the user-supplied array_callback subroutine
for each element in the array (specified by the path).
Variables
Type | Visibility |
Attributes | | Name | | Initial | |
type(json_value), |
public, |
pointer | :: |
p | | | |
Source Code
subroutine json_get_array_with_path(me, path, array_callback, found)
implicit none
type(json_value),pointer,intent(in) :: me
character(kind=CK,len=*),intent(in) :: path
procedure(array_callback_func) :: array_callback
logical(LK),intent(out),optional :: found
type(json_value),pointer :: p
if ( exception_thrown ) then
if ( present(found) ) found = .false.
return
end if
nullify(p)
! resolve the path to the value
call json_get_by_path(me=me, path=path, p=p)
if (.not. associated(p)) then
call throw_exception('Error in json_get_array:'//&
' Unable to resolve path: '//trim(path))
else
call json_get_array(me=p,array_callback=array_callback)
nullify(p)
end if
if ( exception_thrown ) then
if ( present(found) ) then
found = .false.
call json_clear_exceptions()
end if
else
if ( present(found) ) found = .true.
end if
end subroutine json_get_array_with_path