cli_get_string Subroutine

private subroutine cli_get_string(this, name, value, err)

Read a value as a string_type.

Type Bound

cli_t

Arguments

Type IntentOptional Attributes Name
class(cli_t), intent(in) :: this
character(len=*), intent(in) :: name

Long name of a declared entry.

type(string_type), intent(out) :: value

The last value given, or the declared default.

type(error_t), intent(inout), optional :: err

Set to ERROR_VALIDATION when name was never declared.


Calls

proc~~cli_get_string~~CallsGraph proc~cli_get_string cli_t%cli_get_string proc~cli_find cli_t%cli_find proc~cli_get_string->proc~cli_find proc~fail~2 fail proc~cli_get_string->proc~fail~2 proc~error_set error_t%error_set proc~fail~2->proc~error_set

Called by

proc~~cli_get_string~~CalledByGraph proc~cli_get_string cli_t%cli_get_string proc~cli_get_char cli_t%cli_get_char proc~cli_get_char->proc~cli_get_string proc~cli_get_int32 cli_t%cli_get_int32 proc~cli_get_int32->proc~cli_get_string proc~cli_get_int64 cli_t%cli_get_int64 proc~cli_get_int64->proc~cli_get_string proc~cli_get_logical cli_t%cli_get_logical proc~cli_get_logical->proc~cli_get_string proc~cli_get_real_dp cli_t%cli_get_real_dp proc~cli_get_real_dp->proc~cli_get_string proc~cli_get_real_sp cli_t%cli_get_real_sp proc~cli_get_real_sp->proc~cli_get_string

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: idx

Source Code

   subroutine cli_get_string(this, name, value, err)
      !! Read a value as a `string_type`.
      class(cli_t), intent(in) :: this
      character(len=*), intent(in) :: name
         !! Long name of a declared entry.
      type(string_type), intent(out) :: value
         !! The last value given, or the declared default.
      type(error_t), intent(inout), optional :: err
         !! Set to `ERROR_VALIDATION` when `name` was never declared.

      integer(default_int) :: idx

      value = ""
      idx = this%find(name)
      if (idx == 0_default_int) then
         call fail(err, ERROR_VALIDATION, "pic_cli: no such option "//name)
         return
      end if
      value = this%entries(idx)%value
   end subroutine cli_get_string