zep
|
Represents a TOML keytable. More...
#include <cpptoml.h>
Public Types | |
using | iterator = string_to_base_map::iterator |
tables can be iterated over. | |
using | const_iterator = string_to_base_map::const_iterator |
tables can be iterated over. More... | |
Public Member Functions | |
std::shared_ptr< base > | clone () const override |
iterator | begin () |
const_iterator | begin () const |
iterator | end () |
const_iterator | end () const |
bool | is_table () const override |
Determines if the given TOML element is a table. | |
bool | empty () const |
bool | contains (const std::string &key) const |
Determines if this key table contains the given key. | |
bool | contains_qualified (const std::string &key) const |
Determines if this key table contains the given key. More... | |
std::shared_ptr< base > | get (const std::string &key) const |
Obtains the base for a given key. More... | |
std::shared_ptr< base > | get_qualified (const std::string &key) const |
Obtains the base for a given key. More... | |
std::shared_ptr< table > | get_table (const std::string &key) const |
Obtains a table for a given key, if possible. | |
std::shared_ptr< table > | get_table_qualified (const std::string &key) const |
Obtains a table for a given key, if possible. More... | |
std::shared_ptr< array > | get_array (const std::string &key) const |
Obtains an array for a given key. | |
std::shared_ptr< array > | get_array_qualified (const std::string &key) const |
Obtains an array for a given key. More... | |
std::shared_ptr< table_array > | get_table_array (const std::string &key) const |
Obtains a table_array for a given key, if possible. | |
std::shared_ptr< table_array > | get_table_array_qualified (const std::string &key) const |
Obtains a table_array for a given key, if possible. More... | |
template<class T > | |
option< T > | get_as (const std::string &key) const |
Helper function that attempts to get a value corresponding to the template parameter from a given key. | |
template<class T > | |
option< T > | get_qualified_as (const std::string &key) const |
Helper function that attempts to get a value corresponding to the template parameter from a given key. More... | |
template<class T > | |
array_of_trait< T >::return_type | get_array_of (const std::string &key) const |
Helper function that attempts to get an array of values of a given type corresponding to the template parameter for a given key. More... | |
template<class T > | |
array_of_trait< T >::return_type | get_qualified_array_of (const std::string &key) const |
Helper function that attempts to get an array of values of a given type corresponding to the template parameter for a given key. More... | |
void | insert (const std::string &key, const std::shared_ptr< base > &value) |
Adds an element to the keytable. | |
template<class T > | |
void | insert (const std::string &key, T &&val, typename value_traits< T >::type *=0) |
Convenience shorthand for adding a simple element to the keytable. | |
void | erase (const std::string &key) |
Removes an element from the table. | |
template<> | |
array_of_trait< array >::return_type | get_array_of (const std::string &key) const |
Helper function that attempts to get an array of arrays for a given key. More... | |
template<> | |
array_of_trait< array >::return_type | get_qualified_array_of (const std::string &key) const |
Helper function that attempts to get an array of arrays for a given key. More... | |
![]() | |
virtual bool | is_value () const |
Determines if the given TOML element is a value. | |
std::shared_ptr< table > | as_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< array > | as_array () |
Converts the TOML element to an array. | |
virtual bool | is_table_array () const |
Determines if the given TOML element is an array of tables. | |
std::shared_ptr< table_array > | as_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 |
Friends | |
class | table_array |
std::shared_ptr< table > | make_table () |
Represents a TOML keytable.
using cpptoml::table::const_iterator = string_to_base_map::const_iterator |
tables can be iterated over.
Const version.
|
inline |
Determines if this key table contains the given key.
Will resolve "qualified keys". Qualified keys are the full access path separated with dots like "grandparent.parent.child".
|
inline |
Obtains the base for a given key.
std::out_of_range | if the key does not exist |
|
inline |
Helper function that attempts to get an array of values of a given type corresponding to the template parameter for a given key.
If the key doesn't exist, doesn't exist as an array type, or one or more keys inside the array type are not of type T, an empty option is returned. Otherwise, an option containing a vector of the values is returned.
|
inline |
Helper function that attempts to get an array of arrays for a given key.
If the key doesn't exist, doesn't exist as an array type, or one or more keys inside the array type are not of type T, an empty option is returned. Otherwise, an option containing a vector of the values is returned.
|
inline |
Obtains an array for a given key.
Will resolve "qualified keys".
|
inline |
Obtains the base for a given key.
Will resolve "qualified keys". Qualified keys are the full access path separated with dots like "grandparent.parent.child".
std::out_of_range | if the key does not exist |
|
inline |
Helper function that attempts to get an array of values of a given type corresponding to the template parameter for a given key.
Will resolve "qualified keys".
If the key doesn't exist, doesn't exist as an array type, or one or more keys inside the array type are not of type T, an empty option is returned. Otherwise, an option containing a vector of the values is returned.
|
inline |
Helper function that attempts to get an array of arrays for a given key.
Will resolve "qualified keys".
If the key doesn't exist, doesn't exist as an array type, or one or more keys inside the array type are not of type T, an empty option is returned. Otherwise, an option containing a vector of the values is returned.
|
inline |
Helper function that attempts to get a value corresponding to the template parameter from a given key.
Will resolve "qualified keys".
|
inline |
Obtains a table_array for a given key, if possible.
Will resolve "qualified keys".
|
inline |
Obtains a table for a given key, if possible.
Will resolve "qualified keys".