get_a_option Subroutine

private subroutine get_a_option(self, option_name, val, delimiter, error)

Procedure for getting option value (array).

Arguments

TypeIntentOptionalAttributesName
class(section), intent(in) :: self

Section data.

character, intent(in) :: option_name

Option name.

class(*), intent(inout) :: val(1:)

Value.

character, intent(in), optional :: delimiter

Delimiter used for separating values.

integer(kind=I4P), intent(out), optional :: error

Error code.


Contents

Source Code


Source Code

  subroutine get_a_option(self, option_name, val, delimiter, error)
  !< Procedure for getting option value (array).
  class(section), intent(in)            :: self        !< Section data.
  character(*),   intent(in)            :: option_name !< Option name.
  class(*),       intent(inout)         :: val(1:)     !< Value.
  character(*),   intent(in),  optional :: delimiter   !< Delimiter used for separating values.
  integer(I4P),   intent(out), optional :: error       !< Error code.
  character(len=:), allocatable         :: dlm         !< Dummy string for delimiter handling.
  integer(I4P)                          :: errd        !< Error code.
  integer(I4P)                          :: o           !< Counter.

  errd = ERR_OPTION
  dlm = ' ' ; if (present(delimiter)) dlm = delimiter
  if (allocated(self%options)) then
    do o=1, size(self%options, dim=1)
      if (self%options(o) == trim(adjustl(option_name))) then
        call self%options(o)%get(delimiter=dlm, error=errd, val=val)
        exit
      endif
    enddo
  endif
  if (present(error)) error = errd
  endsubroutine get_a_option