Inquire the presence of (at least one) option with the name passed.
Optional, the first matching section name is returned.
All sections are searched and the first occurence is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character, | intent(in) | :: | option_name | Option name. |
||
character, | intent(inout), | optional | :: | section_name | Section name. |
Inquiring flag.
function has_option(self, option_name, section_name) result(pres)
!< Inquire the presence of (at least one) option with the name passed.
!<
!< Optional, the first matching section name is returned.
!<
!< @note All sections are searched and the first occurence is returned.
class(file_ini), intent(in) :: self !< File data.
character(*), intent(in) :: option_name !< Option name.
character(*), optional, intent(inout) :: section_name !< Section name.
logical :: pres !< Inquiring flag.
integer(I4P) :: s !< Counter.
pres = .false.
if (allocated(self%sections)) then
do s=1, size(self%sections, dim=1)
pres = (self%sections(s)%index(option_name=option_name)>0)
if (pres) then
if (present(section_name)) section_name = self%sections(s)%name()
exit
endif
enddo
endif
endfunction has_option