get_sections_list Subroutine

private pure subroutine get_sections_list(self, list)

Get sections names list.

Arguments

TypeIntentOptionalAttributesName
class(file_ini), intent(in) :: self

File data.

character(len=:), intent(out), allocatable:: list(:)

Sections names list.


Contents

Source Code


Source Code

  pure subroutine get_sections_list(self, list)
  !< Get sections names list.
  class(file_ini),               intent(in)  :: self    !< File data.
  character(len=:), allocatable, intent(out) :: list(:) !< Sections names list.
  integer                                    :: max_len !< Max length of section name.
  integer                                    :: s       !< Counter.

  if (allocated(self%sections)) then
    max_len = MinI_P
    do s=1, self%Ns
      max_len = max(max_len, len(self%sections(s)%name()))
    enddo
    if (max_len>0) then
      allocate(character(len=max_len) :: list(1:self%Ns))
      do s=1, self%Ns
        list(s) = self%sections(s)%name()
      enddo
    endif
  endif
  endsubroutine get_sections_list