Get option value (scalar).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | section_name | Section name. |
||
character, | intent(in) | :: | option_name | Option name. |
||
class(*), | intent(inout) | :: | val | Value. |
||
integer(kind=I4P), | intent(out), | optional | :: | error | Error code. |
subroutine get_option(self, section_name, option_name, val, error)
!< Get option value (scalar).
class(file_ini), intent(in) :: self !< File data.
character(*), intent(in) :: section_name !< Section name.
character(*), intent(in) :: option_name !< Option name.
class(*), intent(inout) :: val !< Value.
integer(I4P), intent(out), optional :: error !< Error code.
integer(I4P) :: errd !< Error code.
integer(I4P) :: s !< Counter.
errd = ERR_OPTION
if (allocated(self%sections)) then
do s=1, size(self%sections, dim=1)
if (self%sections(s) == trim(adjustl(section_name))) then
call self%sections(s)%get(error=errd, option_name=option_name, val=val)
exit
endif
enddo
endif
if (present(error)) error = errd
endsubroutine get_option