to_logical Subroutine

private subroutine to_logical(json, p, val, name)

Change the json_value variable to a logical.

Type Bound

json_core

Arguments

Type IntentOptional Attributes Name
class(json_core), intent(inout) :: json
type(json_value), pointer :: p
logical(kind=LK), intent(in), optional :: val

if the value is also to be set (if not present, then .false. is used).

character(kind=CK, len=*), intent(in), optional :: name

if the name is also to be changed.


Calls

proc~~to_logical~~CallsGraph proc~to_logical json_core%to_logical proc~destroy_json_data destroy_json_data proc~to_logical->proc~destroy_json_data

Called by

proc~~to_logical~~CalledByGraph proc~to_logical json_core%to_logical proc~json_update_logical json_core%json_update_logical proc~json_update_logical->proc~to_logical proc~json_value_create_logical json_core%json_value_create_logical proc~json_value_create_logical->proc~to_logical proc~parse_value_nonrecursive parse_value_nonrecursive proc~parse_value_nonrecursive->proc~to_logical proc~parse_value_recursive parse_value_recursive proc~parse_value_recursive->proc~to_logical none~create_logical json_core%create_logical none~create_logical->proc~json_value_create_logical proc~wrap_json_value_create_logical json_core%wrap_json_value_create_logical none~create_logical->proc~wrap_json_value_create_logical proc~json_add_logical_by_path json_core%json_add_logical_by_path proc~json_add_logical_by_path->none~create_logical proc~json_value_add_logical json_core%json_value_add_logical proc~json_value_add_logical->none~create_logical proc~wrap_json_value_create_logical->none~create_logical proc~wrap_json_add_logical_by_path json_core%wrap_json_add_logical_by_path proc~wrap_json_add_logical_by_path->proc~json_add_logical_by_path

Source Code

    subroutine to_logical(json,p,val,name)

    implicit none

    class(json_core),intent(inout)               :: json
    type(json_value),pointer                     :: p
    logical(LK),intent(in),optional              :: val   !! if the value is also to be set
                                                          !! (if not present, then .false. is used).
    character(kind=CK,len=*),intent(in),optional :: name  !! if the name is also to be changed.

    !set type and value:
    call destroy_json_data(p)
    p%var_type = json_logical
    allocate(p%log_value)
    if (present(val)) then
        p%log_value = val
    else
        p%log_value = .false.    !default value
    end if

    !name:
    if (present(name)) call json%rename(p,name)

    end subroutine to_logical