cpptoml
A C++11 parser for TOML
Loading...
Searching...
No Matches
cpptoml::table_array Class Reference
Inheritance diagram for cpptoml::table_array:
cpptoml::base

Public Types

using size_type = std::size_t
using iterator = std::vector<std::shared_ptr<table>>::iterator
 arrays can be iterated over
using const_iterator = std::vector<std::shared_ptr<table>>::const_iterator
 arrays can be iterated over.

Public Member Functions

std::shared_ptr< base > clone () const override
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
virtual bool is_table_array () const override
 Determines if the given TOML element is an array of tables.
std::vector< std::shared_ptr< table > > & get ()
const std::vector< std::shared_ptr< table > > & get () const
void push_back (const std::shared_ptr< table > &val)
 Add a table to the end of the array.
iterator insert (iterator position, const std::shared_ptr< table > &value)
 Insert a table into the array.
iterator erase (iterator position)
 Erase an element from the array.
void clear ()
 Clear the array.
void reserve (size_type n)
 Reserve space for n tables.
bool is_inline () const
 Whether or not the table array is declared inline.
Public Member Functions inherited from cpptoml::base
virtual bool is_value () const
 Determines if the given TOML element is a value.
virtual bool is_table () const
 Determines if the given TOML element is a table.
std::shared_ptr< tableas_table ()
 Converts the TOML element into a table.
virtual bool is_array () const
 Determines if the TOML element is an array of "leaf" elements.
std::shared_ptr< arrayas_array ()
 Converts the TOML element to an array.
std::shared_ptr< table_arrayas_table_array ()
 Converts the TOML element into a table array.
template<class T>
std::shared_ptr< value< T > > as ()
 Attempts to coerce the TOML element into a concrete TOML value of type T.
template<class T>
std::shared_ptr< const value< T > > as () const
template<class Visitor, class... Args>
void accept (Visitor &&visitor, Args &&... args) const
 base implementation of accept() that calls visitor.visit() on the concrete class.
template<>
std::shared_ptr< value< double > > as ()
template<>
std::shared_ptr< const value< double > > as () const

Private Member Functions

 table_array (bool is_inline=false)
 table_array (const table_array &obj)=delete
table_array & operator= (const table_array &rhs)=delete

Private Attributes

std::vector< std::shared_ptr< table > > array_
const bool is_inline_ = false

Friends

class table
std::shared_ptr< table_array > make_table_array (bool is_inline=false)

Member Typedef Documentation

◆ const_iterator

using cpptoml::table_array::const_iterator = std::vector<std::shared_ptr<table>>::const_iterator

arrays can be iterated over.

Const version.

Member Function Documentation

◆ clone()

std::shared_ptr< base > cpptoml::table_array::clone ( ) const
inlineoverridevirtual

Implements cpptoml::base.

◆ is_table_array()

virtual bool cpptoml::table_array::is_table_array ( ) const
inlineoverridevirtual

Determines if the given TOML element is an array of tables.

Reimplemented from cpptoml::base.

◆ is_inline()

bool cpptoml::table_array::is_inline ( ) const
inline

Whether or not the table array is declared inline.

This mostly matters for parsing, where statically defined arrays cannot be appended to using the array-of-table syntax.


The documentation for this class was generated from the following file: