is_array_of_tables Function

public function is_array_of_tables(array) result(only_tables)

Determine if array contains only tables

Arguments

Type IntentOptional Attributes Name
class(toml_array), intent(inout) :: array

TOML value to visit

Return Value logical

Array contains only tables


Source Code

function is_array_of_tables(array) result(only_tables)

   !> TOML value to visit
   class(toml_array), intent(inout) :: array

   !> Array contains only tables
   logical :: only_tables

   class(toml_value), pointer :: ptr
   integer :: i, n


   n = len(array)
   only_tables = n > 0

   do i = 1, n
      call array%get(i, ptr)
      select type(ptr)
      type is(toml_table)
         cycle
      class default
         only_tables = .false.
         exit
      end select
   end do

end function is_array_of_tables