toml_array_list Derived Type

type, public, extends(toml_list_structure) :: toml_array_list

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 :: destroy

Destroy the data structure

  • private subroutine destroy(self)

    Deconstructor for data structure

    Arguments

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

    Instance of the structure

procedure, public :: get

Get TOML value at a given index

  • private subroutine get(self, idx, ptr)

    Get TOML value at a given index

    Arguments

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

    Instance of the structure

    integer, intent(in) :: idx

    Position in the ordered structure

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

    Pointer to the stored value at given index

procedure, public :: get_len

Get number of TOML values in the structure

  • private pure function get_len(self) result(length)

    Get number of TOML values in the structure

    Arguments

    Type IntentOptional Attributes Name
    class(toml_array_list), intent(in), target :: self

    Instance of the structure

    Return Value integer

    Current length of the ordered structure

procedure, public :: pop

Remove the last element from the structure

  • private subroutine pop(self, val)

    Remove the last element from the data structure

    Arguments

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

    Instance of the structure

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

    TOML value to be retrieved

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_array_list), intent(inout), target :: self

    Instance of the structure

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

    TOML value to be stored

procedure, public :: shift

Remove the first element from the structure

  • private subroutine shift(self, val)

    Remove the first element from the data structure

    Arguments

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

    Instance of the structure

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

    TOML value to be retrieved

Source Code

   type, extends(toml_list_structure) :: toml_array_list

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

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

   contains

      !> Get number of TOML values in the structure
      procedure :: get_len

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

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

      !> Remove the first element from the structure
      procedure :: shift

      !> Remove the last element from the structure
      procedure :: pop

      !> Destroy the data structure
      procedure :: destroy

   end type toml_array_list