| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(input_t), | intent(in) | :: | me | |||
| character(len=*), | intent(in) | :: | key | |||
| type(str_ptr), | intent(in), | optional | :: | default_value | ||
| logical, | intent(in), | optional | :: | empty |
function input_str1d(me,key,default_value,empty) result(val) class(input_t), intent(in) :: me character(*), intent(in) :: key type(str_ptr), optional, intent(in) :: default_value type(str_ptr), allocatable :: val(:) logical, optional, intent(in) :: empty type(type_list_item), pointer :: item type(type_scalar), pointer :: element integer :: i if(present(empty)) then if(.not. me%has_key(key) .and. empty) then allocate(val(0)) return endif endif if(present(default_value)) val = default_value if(.not.me%has_key(key) .and. present(default_value)) return select type(node=>me%node(key));class is(type_list) if (allocated(val)) deallocate(val) allocate(val(node%size())) item => node%first i = 1 do while(associated(item)) element => select_scalar(item%node); val(i)%p => element%string item => item%next i = i + 1 enddo return end select if(present(default_value)) return error stop 'Can not convert to 1d array of "string" for key: '//key end function input_str1d