to_integer Subroutine

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

Change the json_value variable to an integer.

Type Bound

json_core

Arguments

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

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

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

if the name is also to be changed.


Calls

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

Called by

proc~~to_integer~~CalledByGraph proc~to_integer json_core%to_integer proc~json_update_integer json_core%json_update_integer proc~json_update_integer->proc~to_integer proc~json_value_create_integer json_core%json_value_create_integer proc~json_value_create_integer->proc~to_integer proc~parse_number json_core%parse_number proc~parse_number->proc~to_integer none~create_integer json_core%create_integer none~create_integer->proc~json_value_create_integer proc~wrap_json_value_create_integer json_core%wrap_json_value_create_integer none~create_integer->proc~wrap_json_value_create_integer proc~parse_value json_core%parse_value proc~parse_value->proc~parse_number proc~parse_array json_core%parse_array proc~parse_value->proc~parse_array proc~parse_object json_core%parse_object proc~parse_value->proc~parse_object proc~json_add_integer_by_path json_core%json_add_integer_by_path proc~json_add_integer_by_path->none~create_integer proc~json_parse_file json_core%json_parse_file proc~json_parse_file->proc~parse_value proc~json_parse_string json_core%json_parse_string proc~json_parse_string->proc~parse_value proc~json_value_add_integer json_core%json_value_add_integer proc~json_value_add_integer->none~create_integer proc~parse_array->proc~parse_value proc~parse_object->proc~parse_value proc~parse_object->proc~parse_object proc~wrap_json_value_create_integer->none~create_integer none~deserialize~2 json_core%deserialize none~deserialize~2->proc~json_parse_string proc~wrap_json_parse_string json_core%wrap_json_parse_string none~deserialize~2->proc~wrap_json_parse_string none~load~2 json_core%load none~load~2->proc~json_parse_file proc~wrap_json_add_integer_by_path json_core%wrap_json_add_integer_by_path proc~wrap_json_add_integer_by_path->proc~json_add_integer_by_path proc~json_file_load json_file%json_file_load proc~json_file_load->none~load~2 proc~json_file_load_from_string json_file%json_file_load_from_string proc~json_file_load_from_string->none~deserialize~2 proc~wrap_json_parse_string->none~deserialize~2 none~deserialize json_file%deserialize none~deserialize->proc~json_file_load_from_string proc~wrap_json_file_load_from_string json_file%wrap_json_file_load_from_string none~deserialize->proc~wrap_json_file_load_from_string proc~assign_string_to_json_file json_file%assign_string_to_json_file proc~assign_string_to_json_file->none~deserialize proc~initialize_json_file_from_string initialize_json_file_from_string proc~initialize_json_file_from_string->none~deserialize proc~initialize_json_file_from_string_v2 initialize_json_file_from_string_v2 proc~initialize_json_file_from_string_v2->none~deserialize proc~wrap_json_file_load_from_string->none~deserialize interface~json_file json_file interface~json_file->proc~initialize_json_file_from_string interface~json_file->proc~initialize_json_file_from_string_v2 proc~wrap_initialize_json_file_from_string wrap_initialize_json_file_from_string interface~json_file->proc~wrap_initialize_json_file_from_string proc~wrap_initialize_json_file_from_string_v2 wrap_initialize_json_file_from_string_v2 interface~json_file->proc~wrap_initialize_json_file_from_string_v2 proc~wrap_assign_string_to_json_file json_file%wrap_assign_string_to_json_file proc~wrap_assign_string_to_json_file->proc~assign_string_to_json_file proc~wrap_initialize_json_file_from_string->proc~initialize_json_file_from_string proc~wrap_initialize_json_file_from_string_v2->proc~initialize_json_file_from_string_v2

Source Code

    subroutine to_integer(json,p,val,name)

    implicit none

    class(json_core),intent(inout)               :: json
    type(json_value),pointer                     :: p
    integer(IK),intent(in),optional              :: val   !! if the value is also to be set
                                                          !! (if not present, then 0 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_integer
    allocate(p%int_value)
    if (present(val)) then
        p%int_value = val
    else
        p%int_value = 0_IK    !default value
    end if

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

    end subroutine to_integer