tomlf_type Module

Collection of the central datatypes to define TOML data structures

All TOML data types should inherit from an abstract value allowing to generate a generic interface to deal with all more specialized TOML data types, while the abstract value is interesting for developing algorithms in TOML-Fortran, the user of TOML-Fortran will usually only care about TOML tables and possibly arrays.

The TOML types defined here should implement the TOML data structures (mostly) without taking the actual implementation of the data structures into account. This is done by providing a bare minimum interface using type bound procedures to minimize the interdependencies between the datatypes.

To make the data types extendable a visitor pattern allows access to the TOML data types and can be used to implement further algorithms.



Interfaces

public interface add_array

Interface to build new arrays

  • private subroutine add_array_to_table(table, key, ptr, stat)

    Create a new TOML array inside an existing table

    Arguments

    Type IntentOptional Attributes Name
    class(toml_table), intent(inout) :: table

    Instance of the TOML table

    character(kind=tfc, len=*), intent(in) :: key

    Key for the new array

    type(toml_array), intent(out), pointer :: ptr

    Pointer to the newly created array

    integer, intent(out), optional :: stat

    Status of operation

  • private subroutine add_array_to_table_key(table, key, ptr, stat)

    Create a new TOML array inside an existing table

    Arguments

    Type IntentOptional Attributes Name
    class(toml_table), intent(inout) :: table

    Instance of the TOML table

    type(toml_key), intent(in) :: key

    Key for the new array

    type(toml_array), intent(out), pointer :: ptr

    Pointer to the newly created array

    integer, intent(out), optional :: stat

    Status of operation

  • private subroutine add_array_to_array(array, ptr, stat)

    Create a new TOML array inside an existing array

    Arguments

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

    Instance of the TOML array

    type(toml_array), intent(out), pointer :: ptr

    Pointer to the newly created array

    integer, intent(out), optional :: stat

    Status of operation

public interface add_keyval

Interface to build new key-value pairs

  • private subroutine add_keyval_to_table(table, key, ptr, stat)

    Create a new key-value pair inside an existing table

    Arguments

    Type IntentOptional Attributes Name
    class(toml_table), intent(inout) :: table

    Instance of the TOML table

    character(kind=tfc, len=*), intent(in) :: key

    Key for the new key-value pair

    type(toml_keyval), intent(out), pointer :: ptr

    Pointer to the newly created key-value pair

    integer, intent(out), optional :: stat

    Status of operation

  • private subroutine add_keyval_to_table_key(table, key, ptr, stat)

    Create a new key-value pair inside an existing table

    Arguments

    Type IntentOptional Attributes Name
    class(toml_table), intent(inout) :: table

    Instance of the TOML table

    type(toml_key), intent(in) :: key

    Key for the new key-value pair

    type(toml_keyval), intent(out), pointer :: ptr

    Pointer to the newly created key-value pair

    integer, intent(out), optional :: stat

    Status of operation

  • private subroutine add_keyval_to_array(array, ptr, stat)

    Create a new key-value pair inside an existing array

    Arguments

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

    Instance of the TOML array

    type(toml_keyval), intent(out), pointer :: ptr

    Pointer to the newly created key-value pair

    integer, intent(out), optional :: stat

    Status of operation

public interface add_table

Interface to build new tables

  • private subroutine add_table_to_table(table, key, ptr, stat)

    Create a new TOML table inside an existing table

    Arguments

    Type IntentOptional Attributes Name
    class(toml_table), intent(inout) :: table

    Instance of the TOML table

    character(kind=tfc, len=*), intent(in) :: key

    Key for the new table

    type(toml_table), intent(out), pointer :: ptr

    Pointer to the newly created table

    integer, intent(out), optional :: stat

    Status of operation

  • private subroutine add_table_to_table_key(table, key, ptr, stat)

    Create a new TOML table inside an existing table

    Arguments

    Type IntentOptional Attributes Name
    class(toml_table), intent(inout) :: table

    Instance of the TOML table

    type(toml_key), intent(in) :: key

    Key for the new table

    type(toml_table), intent(out), pointer :: ptr

    Pointer to the newly created table

    integer, intent(out), optional :: stat

    Status of operation

  • private subroutine add_table_to_array(array, ptr, stat)

    Create a new TOML table inside an existing array

    Arguments

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

    Instance of the TOML array

    type(toml_table), intent(out), pointer :: ptr

    Pointer to the newly created table

    integer, intent(out), optional :: stat

    Status of operation


Functions

public function cast_to_array(ptr) result(array)

Cast an abstract TOML value to a TOML array

Arguments

Type IntentOptional Attributes Name
class(toml_value), intent(in), target :: ptr

TOML value to be casted

Return Value type(toml_array), pointer

TOML array view, nullified if the value is not an array

public function cast_to_keyval(ptr) result(kval)

Cast an abstract TOML value to a TOML key-value pair

Arguments

Type IntentOptional Attributes Name
class(toml_value), intent(in), target :: ptr

TOML value to be casted

Return Value type(toml_keyval), pointer

TOML key-value view, nullified if the value is not a table

public function cast_to_table(ptr) result(table)

Cast an abstract TOML value to a TOML table

Arguments

Type IntentOptional Attributes Name
class(toml_value), intent(in), target :: ptr

TOML value to be casted

Return Value type(toml_table), pointer

TOML table view, nullified if the value is not a table

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