Get list of pairs option name/value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_ini), | intent(in) | :: | self | File data. |
||
character(len=:), | intent(out), | allocatable | :: | items(:,:) | Items, list of pairs option name/value for all options [1:No,1:2]. |
pure subroutine get_items(self, items)
!< Get list of pairs option name/value.
class(file_ini), intent(in) :: self !< File data.
character(len=:), allocatable, intent(out) :: items(:,:) !< Items, list of pairs option name/value for all options [1:No,1:2].
character(len=:), allocatable :: pairs(:) !< Option name/values pairs.
integer(I4P) :: mx_chars !< Maximum number of chars into name/value within all options.
integer(I4P) :: o !< Counter.
integer(I4P) :: s !< Counter.
integer(I4P) :: No !< Counter.
mx_chars = MinI4P
if (allocated(self%sections)) then
No = 0
do s=1, size(self%sections, dim=1)
if (self%sections(s)%has_options()) then
mx_chars = max(mx_chars, self%sections(s)%max_chars_len())
No = No + self%sections(s)%options_number()
endif
enddo
if ((mx_chars > 0).and.(No > 0)) then
allocate(character(mx_chars):: items(1:No, 1:2))
No = 0
do s=1, size(self%sections, dim=1)
if (self%sections(s)%has_options()) then
do o=1, self%sections(s)%options_number()
No = No + 1
call self%sections(s)%option_pairs(option_index=o, pairs=pairs)
items(No, 1) = pairs(1)
items(No, 2) = pairs(2)
enddo
endif
enddo
endif
endif
endsubroutine get_items