GRASP rci-qed
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cpptoml::array Class Reference

#include <cpptoml.h>

Inheritance diagram for cpptoml::array:
Inheritance graph
[legend]
Collaboration diagram for cpptoml::array:
Collaboration graph
[legend]

Public Types

using size_type = std::size_t
 
using iterator = std::vector< std::shared_ptr< base > >::iterator
 
using const_iterator = std::vector< std::shared_ptr< base > >::const_iterator
 

Public Member Functions

std::shared_ptr< baseclone () const override
 
virtual bool is_array () const override
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
std::vector< std::shared_ptr< base > > & get ()
 
const std::vector< std::shared_ptr< base > > & get () const
 
std::shared_ptr< baseat (size_t idx) const
 
template<class T >
std::vector< std::shared_ptr< value< T > > > array_of () const
 
template<class T >
array_of_trait< T >::return_type get_array_of () const
 
std::vector< std::shared_ptr< array > > nested_array () const
 
template<class T >
void push_back (const std::shared_ptr< value< T >> &val)
 
void push_back (const std::shared_ptr< array > &val)
 
template<class T >
void push_back (T &&val, typename value_traits< T >::type *=0)
 
template<class T >
iterator insert (iterator position, const std::shared_ptr< value< T >> &value)
 
iterator insert (iterator position, const std::shared_ptr< array > &value)
 
template<class T >
iterator insert (iterator position, T &&val, typename value_traits< T >::type *=0)
 
iterator erase (iterator position)
 
void clear ()
 
void reserve (size_type n)
 
template<>
array_of_trait< array >::return_type get_array_of () const
 
- Public Member Functions inherited from cpptoml::base
virtual ~base ()=default
 
virtual bool is_value () const
 
virtual bool is_table () const
 
std::shared_ptr< tableas_table ()
 
std::shared_ptr< arrayas_array ()
 
virtual bool is_table_array () const
 
std::shared_ptr< table_arrayas_table_array ()
 
template<class T >
std::shared_ptr< value< T > > as ()
 
template<class T >
std::shared_ptr< const value< T > > as () const
 
template<class Visitor , class... Args>
void accept (Visitor &&visitor, Args &&... args) const
 
template<>
std::shared_ptr< value< double > > as ()
 
template<>
std::shared_ptr< const value< double > > as () const
 

Private Member Functions

 array ()=default
 
template<class InputIterator >
 array (InputIterator begin, InputIterator end)
 
 array (const array &obj)=delete
 
arrayoperator= (const array &obj)=delete
 

Private Attributes

std::vector< std::shared_ptr< base > > values_
 

Friends

std::shared_ptr< arraymake_array ()
 

Additional Inherited Members

- Protected Member Functions inherited from cpptoml::base
 base ()
 

Member Typedef Documentation

◆ const_iterator

using cpptoml::array::const_iterator = std::vector<std::shared_ptr<base> >::const_iterator

arrays can be iterated over. Const version.

◆ iterator

using cpptoml::array::iterator = std::vector<std::shared_ptr<base> >::iterator

arrays can be iterated over

◆ size_type

using cpptoml::array::size_type = std::size_t

Constructor & Destructor Documentation

◆ array() [1/3]

cpptoml::array::array ( )
privatedefault

◆ array() [2/3]

template<class InputIterator >
cpptoml::array::array ( InputIterator  begin,
InputIterator  end 
)
inlineprivate

◆ array() [3/3]

cpptoml::array::array ( const array obj)
privatedelete

Member Function Documentation

◆ array_of()

template<class T >
std::vector<std::shared_ptr<value<T> > > cpptoml::array::array_of ( ) const
inline

Obtains an array of value<T>s. Note that elements may be nullptr if they cannot be converted to a value<T>.

◆ at()

std::shared_ptr<base> cpptoml::array::at ( size_t  idx) const
inline

◆ begin() [1/2]

iterator cpptoml::array::begin ( )
inline

◆ begin() [2/2]

const_iterator cpptoml::array::begin ( ) const
inline

◆ clear()

void cpptoml::array::clear ( )
inline

Clear the array

◆ clone()

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

Implements cpptoml::base.

Here is the call graph for this function:

◆ end() [1/2]

iterator cpptoml::array::end ( )
inline

◆ end() [2/2]

const_iterator cpptoml::array::end ( ) const
inline

◆ erase()

iterator cpptoml::array::erase ( iterator  position)
inline

Erase an element from the array

◆ get() [1/2]

std::vector<std::shared_ptr<base> >& cpptoml::array::get ( )
inline

Obtains the array (vector) of base values.

Here is the caller graph for this function:

◆ get() [2/2]

const std::vector<std::shared_ptr<base> >& cpptoml::array::get ( ) const
inline

Obtains the array (vector) of base values. Const version.

◆ get_array_of() [1/2]

template<class T >
array_of_trait<T>::return_type cpptoml::array::get_array_of ( ) const
inline

Obtains a option<vector<T>>. The option will be empty if the array contains values that are not of type T.

◆ get_array_of() [2/2]

template<>
array_of_trait<array>::return_type cpptoml::array::get_array_of ( ) const
inline

Obtains a option<vector<T>>. The option will be empty if the array contains values that are not of type T.

◆ insert() [1/3]

template<class T >
iterator cpptoml::array::insert ( iterator  position,
const std::shared_ptr< value< T >> &  value 
)
inline

Insert a value into the array

◆ insert() [2/3]

iterator cpptoml::array::insert ( iterator  position,
const std::shared_ptr< array > &  value 
)
inline

Insert an array into the array

◆ insert() [3/3]

template<class T >
iterator cpptoml::array::insert ( iterator  position,
T &&  val,
typename value_traits< T >::type *  = 0 
)
inline

Convenience function for inserting a simple element in the array

Here is the call graph for this function:

◆ is_array()

virtual bool cpptoml::array::is_array ( ) const
inlineoverridevirtual

Determines if the TOML element is an array of "leaf" elements.

Reimplemented from cpptoml::base.

◆ nested_array()

std::vector<std::shared_ptr<array> > cpptoml::array::nested_array ( ) const
inline

Obtains an array of arrays. Note that elements may be nullptr if they cannot be converted to a array.

◆ operator=()

array& cpptoml::array::operator= ( const array obj)
privatedelete

◆ push_back() [1/3]

template<class T >
void cpptoml::array::push_back ( const std::shared_ptr< value< T >> &  val)
inline

Add a value to the end of the array

◆ push_back() [2/3]

void cpptoml::array::push_back ( const std::shared_ptr< array > &  val)
inline

Add an array to the end of the array

◆ push_back() [3/3]

template<class T >
void cpptoml::array::push_back ( T &&  val,
typename value_traits< T >::type *  = 0 
)
inline

Convenience function for adding a simple element to the end of the array.

Here is the call graph for this function:

◆ reserve()

void cpptoml::array::reserve ( size_type  n)
inline

Reserve space for n values.

Friends And Related Function Documentation

◆ make_array

std::shared_ptr<array> make_array ( )
friend

Member Data Documentation

◆ values_

std::vector<std::shared_ptr<base> > cpptoml::array::values_
private

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