keys_equal Function

private function keys_equal(me, key1, key2) result(equal)

Compare two keys for equality, taking into account the setting for trailing spaces.

It is assumed that preprocess_key has already been applied to both keys before calling this function. This allows us to avoid redundant lowercasing and trimming of the keys.

See also

Type Bound

json_hash_table

Arguments

Type IntentOptional Attributes Name
class(json_hash_table), intent(in) :: me
character(kind=CK, len=*), intent(in) :: key1
character(kind=CK, len=*), intent(in) :: key2

Return Value logical(kind=LK)


Called by

proc~~keys_equal~~CalledByGraph proc~keys_equal json_hash_table%keys_equal proc~hash_table_get json_hash_table%hash_table_get proc~hash_table_get->proc~keys_equal proc~hash_table_insert json_hash_table%hash_table_insert proc~hash_table_insert->proc~keys_equal proc~hash_table_resize json_hash_table%hash_table_resize proc~hash_table_insert->proc~hash_table_resize proc~hash_table_create_from_value json_hash_table%hash_table_create_from_value proc~hash_table_create_from_value->proc~hash_table_insert proc~hash_table_resize->proc~hash_table_insert proc~json_file_get_object json_file%json_file_get_object proc~json_file_get_object->proc~hash_table_get none~get json_file%get none~get->proc~json_file_get_object proc~json_file_get_alloc_string_vec json_file%json_file_get_alloc_string_vec none~get->proc~json_file_get_alloc_string_vec proc~json_file_get_integer json_file%json_file_get_integer none~get->proc~json_file_get_integer proc~json_file_get_integer_vec json_file%json_file_get_integer_vec none~get->proc~json_file_get_integer_vec proc~json_file_get_logical json_file%json_file_get_logical none~get->proc~json_file_get_logical proc~json_file_get_logical_vec json_file%json_file_get_logical_vec none~get->proc~json_file_get_logical_vec proc~json_file_get_real json_file%json_file_get_real none~get->proc~json_file_get_real proc~json_file_get_real32 json_file%json_file_get_real32 none~get->proc~json_file_get_real32 proc~json_file_get_real32_vec json_file%json_file_get_real32_vec none~get->proc~json_file_get_real32_vec proc~json_file_get_real_vec json_file%json_file_get_real_vec none~get->proc~json_file_get_real_vec proc~json_file_get_string json_file%json_file_get_string none~get->proc~json_file_get_string proc~json_file_get_string_vec json_file%json_file_get_string_vec none~get->proc~json_file_get_string_vec proc~wrap_json_file_get_alloc_string_vec json_file%wrap_json_file_get_alloc_string_vec none~get->proc~wrap_json_file_get_alloc_string_vec proc~wrap_json_file_get_integer json_file%wrap_json_file_get_integer none~get->proc~wrap_json_file_get_integer proc~wrap_json_file_get_integer_vec json_file%wrap_json_file_get_integer_vec none~get->proc~wrap_json_file_get_integer_vec proc~wrap_json_file_get_logical json_file%wrap_json_file_get_logical none~get->proc~wrap_json_file_get_logical proc~wrap_json_file_get_logical_vec json_file%wrap_json_file_get_logical_vec none~get->proc~wrap_json_file_get_logical_vec proc~wrap_json_file_get_object json_file%wrap_json_file_get_object none~get->proc~wrap_json_file_get_object proc~wrap_json_file_get_real json_file%wrap_json_file_get_real none~get->proc~wrap_json_file_get_real proc~wrap_json_file_get_real32 json_file%wrap_json_file_get_real32 none~get->proc~wrap_json_file_get_real32 proc~wrap_json_file_get_real32_vec json_file%wrap_json_file_get_real32_vec none~get->proc~wrap_json_file_get_real32_vec proc~wrap_json_file_get_real_vec json_file%wrap_json_file_get_real_vec none~get->proc~wrap_json_file_get_real_vec proc~wrap_json_file_get_string json_file%wrap_json_file_get_string none~get->proc~wrap_json_file_get_string proc~wrap_json_file_get_string_vec json_file%wrap_json_file_get_string_vec none~get->proc~wrap_json_file_get_string_vec proc~initialize_hash json_file%initialize_hash proc~initialize_hash->proc~hash_table_create_from_value proc~initialize_hash->none~get proc~json_file_get_alloc_string_vec->none~get proc~json_file_get_integer->none~get proc~json_file_get_integer_vec->none~get proc~json_file_get_logical->none~get proc~json_file_get_logical_vec->none~get proc~json_file_get_real->none~get proc~json_file_get_real32->none~get proc~json_file_get_real32_vec->none~get proc~json_file_get_real_vec->none~get proc~json_file_get_string->none~get proc~json_file_get_string_vec->none~get proc~wrap_json_file_get_alloc_string_vec->none~get proc~wrap_json_file_get_integer->none~get proc~wrap_json_file_get_integer_vec->none~get proc~wrap_json_file_get_logical->none~get proc~wrap_json_file_get_logical_vec->none~get proc~wrap_json_file_get_object->none~get proc~wrap_json_file_get_real->none~get proc~wrap_json_file_get_real32->none~get proc~wrap_json_file_get_real32_vec->none~get proc~wrap_json_file_get_real_vec->none~get proc~wrap_json_file_get_string->none~get proc~wrap_json_file_get_string_vec->none~get

Source Code

    function keys_equal(me, key1, key2) result(equal)

        class(json_hash_table), intent(in) :: me
        character(kind=CK,len=*), intent(in) :: key1
        character(kind=CK,len=*), intent(in) :: key2
        logical(LK) :: equal

        if (me%trailing_spaces_significant) then
            ! if trailing spaces are significant, then the keys
            ! must be equal in length
            equal = len(key1) == len(key2)
            if (.not. equal) return
        end if
        equal = key1 == key2

    end function keys_equal