@@ -28,7 +28,7 @@ module fpm_toml
28
28
public :: read_package_file, toml_table, toml_array, toml_key, toml_stat, &
29
29
get_value, set_value, get_list, new_table, add_table, add_array, len, &
30
30
toml_error, toml_serialize, toml_load, check_keys, set_list, set_string, &
31
- name_is_json
31
+ name_is_json, has_list
32
32
33
33
! > An abstract interface for any fpm class that should be fully serializable to/from TOML/JSON
34
34
type, abstract, public :: serializable_t
@@ -337,6 +337,29 @@ subroutine read_package_file(table, manifest, error)
337
337
end if
338
338
339
339
end subroutine read_package_file
340
+
341
+ ! > Check if an instance of the TOML data structure contains a list
342
+ logical function has_list (table , key )
343
+
344
+ ! > Instance of the TOML data structure
345
+ type (toml_table), intent (inout ) :: table
346
+
347
+ ! > Key to read from
348
+ character (len=* ), intent (in ) :: key
349
+
350
+ type (toml_array), pointer :: children
351
+
352
+ has_list = .false.
353
+
354
+ if (.not. table% has_key(key)) return
355
+
356
+ call get_value(table, key, children, requested= .false. )
357
+
358
+ ! There is an allocated list
359
+ has_list = associated (children)
360
+
361
+ end function has_list
362
+
340
363
341
364
subroutine get_list (table , key , list , error )
342
365
0 commit comments