get_by_name_string Function

private function get_by_name_string(this, name) result(p)

Arguments

Type IntentOptional AttributesName
type(fson_value), pointer:: this
type(fson_string), pointer:: name

Return Value type(fson_value), pointer


Contents

Source Code


Source Code

  function get_by_name_string(this, name) result(p)
    use fson_string_m, only: fson_string, fson_string_equals
    implicit none

    type(fson_value), pointer :: this, p
    type(fson_string), pointer :: name
    integer :: i

    if (this % value_type /= TYPE_OBJECT) then
       nullify(p)
       return
    end if

    do i=1, fson_value_count(this)
       p => fson_value_get(this, i)
       if (fson_string_equals(p%name, name)) then
          return
       end if
    end do

    ! didn't find anything
    nullify(p)

  end function get_by_name_string