toml_ordered_map Derived Type

type, public, extends(toml_map_structure) :: toml_ordered_map

Stores TOML values in a list of pointers


Components

Type Visibility Attributes Name Initial
type(toml_node), public, allocatable :: lst(:)

List of TOML values

integer, public :: n = 0

Current number of stored TOML values


Type-Bound Procedures

procedure, public :: delete

Delete TOML value at a given key

  • private subroutine delete(self, key)

    Delete TOML value at a given key

    Arguments

    Type IntentOptional Attributes Name
    class(toml_ordered_map), intent(inout), target :: self

    Instance of the structure

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

    Key to the TOML value

procedure, public :: destroy

Destroy the data structure

  • private subroutine destroy(self)

    Deconstructor for data structure

    Arguments

    Type IntentOptional Attributes Name
    class(toml_ordered_map), intent(inout), target :: self

    Instance of the structure

procedure, public :: get

Get TOML value at a given key

  • private subroutine get(self, key, ptr)

    Get TOML value at a given key

    Arguments

    Type IntentOptional Attributes Name
    class(toml_ordered_map), intent(inout), target :: self

    Instance of the structure

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

    Key to the TOML value

    class(toml_value), intent(out), pointer :: ptr

    Pointer to the stored value at given key

procedure, public :: get_keys

Get list of all keys in the structure

  • private subroutine get_keys(self, list)

    Get list of all keys in the structure

    Arguments

    Type IntentOptional Attributes Name
    class(toml_ordered_map), intent(inout), target :: self

    Instance of the structure

    type(toml_key), intent(out), allocatable :: list(:)

    List of all keys

procedure, public :: pop

Remove TOML value at a given key and return it

  • private subroutine pop(self, key, val)

    Remove TOML value at a given key and return it

    Arguments

    Type IntentOptional Attributes Name
    class(toml_ordered_map), intent(inout), target :: self

    Instance of the structure

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

    Key to the TOML value

    class(toml_value), intent(out), allocatable :: val

    Removed TOML value

procedure, public :: push_back

Push back a TOML value to the structure

  • private subroutine push_back(self, val)

    Push back a TOML value to the structure

    Arguments

    Type IntentOptional Attributes Name
    class(toml_ordered_map), intent(inout), target :: self

    Instance of the structure

    class(toml_value), intent(inout), allocatable :: val

    TOML value to be stored

Source Code

   type, extends(toml_map_structure) :: toml_ordered_map

      !> Current number of stored TOML values
      integer :: n = 0

      !> List of TOML values
      type(toml_node), allocatable :: lst(:)

   contains

      !> Get TOML value at a given key
      procedure :: get

      !> Push back a TOML value to the structure
      procedure :: push_back

      !> Remove TOML value at a given key and return it
      procedure :: pop

      !> Get list of all keys in the structure
      procedure :: get_keys

      !> Delete TOML value at a given key
      procedure :: delete

      !> Destroy the data structure
      procedure :: destroy

   end type toml_ordered_map