Loop returning option name/value defined into all sections.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character(len=:), | intent(out), | allocatable | :: | option_pairs(:) | Pairs option name/value [1:2]. |
Flag continuing the loop.
recursive function loop_options(self, option_pairs) result(again)
!< Loop returning option name/value defined into all sections.
class(file_ini), intent(IN) :: self !< File data.
character(len=:), allocatable, intent(OUT) :: option_pairs(:) !< Pairs option name/value [1:2].
logical :: again !< Flag continuing the loop.
logical, save :: againO=.false. !< Flag continuing the loop.
integer(I4P), save :: s=0 !< Counter.
again = .false.
if (allocated(self%sections)) then
if (s==0) then
s = lbound(self%sections, dim=1)
againO = self%loop(section_name=self%sections(s)%name(), option_pairs=option_pairs)
again = .true.
elseif (s<ubound(self%sections, dim=1)) then
if (.not.againO) s = s + 1
againO = self%loop(section_name=self%sections(s)%name(), option_pairs=option_pairs)
if (.not.againO) then
again = self%loop(option_pairs=option_pairs)
else
again = .true.
endif
else
s = 0
againO = .false.
again = .false.
endif
endif
endfunction loop_options