#include <cpptoml.h>
Definition at line 673 of file cpptoml.h.
◆ const_iterator
arrays can be iterated over. Const version.
Definition at line 691 of file cpptoml.h.
◆ iterator
arrays can be iterated over
Definition at line 686 of file cpptoml.h.
◆ size_type
◆ array() [1/4]
cpptoml::array::array |
( |
| ) |
|
|
inlineprivate |
◆ array() [2/4]
cpptoml::array::array |
( |
| ) |
|
|
privatedefault |
◆ array() [3/4]
template<class InputIterator >
cpptoml::array::array |
( |
InputIterator |
begin, |
|
|
InputIterator |
end |
|
) |
| |
|
inlineprivate |
Definition at line 852 of file cpptoml.h.
853
854 }
std::vector< std::shared_ptr< base > > values_
◆ array() [4/4]
cpptoml::array::array |
( |
const array & |
obj | ) |
|
|
delete |
◆ 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>.
Definition at line 718 of file cpptoml.h.
718 {
719 std::vector<std::shared_ptr<value<T>>> result(
values_.size());
720
722 [&](const std::shared_ptr<base>& v) { return v->as<T>(); });
723
724 return result;
725 }
◆ at()
std::shared_ptr< base > cpptoml::array::at |
( |
size_t |
idx | ) |
const |
|
inline |
◆ begin() [1/2]
◆ begin() [2/2]
◆ clear()
void cpptoml::array::clear |
( |
| ) |
|
|
inline |
◆ clone()
std::shared_ptr< base > cpptoml::array::clone |
( |
| ) |
const |
|
inlineoverridevirtual |
Implements cpptoml::base.
Definition at line 1437 of file cpptoml.h.
1437 {
1439 result->reserve(
values_.size());
1440 for(
const auto& ptr :
values_)
1441 result->values_.push_back(ptr->clone());
1442 return result;
1443}
friend std::shared_ptr< array > make_array()
◆ end() [1/2]
◆ end() [2/2]
◆ erase()
Erase an element from the array
Definition at line 828 of file cpptoml.h.
828{
return values_.erase(position); }
◆ get() [1/2]
std::vector< std::shared_ptr< base > > & cpptoml::array::get |
( |
| ) |
|
|
inline |
Obtains the array (vector) of base values.
Definition at line 704 of file cpptoml.h.
◆ get() [2/2]
const std::vector< std::shared_ptr< base > > & cpptoml::array::get |
( |
| ) |
const |
|
inline |
Obtains the array (vector) of base values. Const version.
Definition at line 709 of file cpptoml.h.
◆ 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.
Definition at line 732 of file cpptoml.h.
732 {
733 std::vector<T> result;
734 result.reserve(
values_.size());
735
736 for(
const auto& val :
values_) {
737 if(auto v = val->as<T>())
738 result.push_back(v->get());
739 else
740 return {};
741 }
742
743 return {std::move(result)};
744 }
◆ get_array_of() [2/2]
Obtains a option<vector<T>>. The option will be empty if the array contains values that are not of type T.
Definition at line 895 of file cpptoml.h.
895 {
896 std::vector<std::shared_ptr<array>> result;
897 result.reserve(
values_.size());
898
899 for(
const auto& val :
values_) {
900 if(auto v = val->as_array())
901 result.push_back(v);
902 else
903 return {};
904 }
905
906 return {std::move(result)};
907}
◆ insert() [1/3]
Insert an array into the array
Definition at line 809 of file cpptoml.h.
809 {
811 return values_.insert(position, value);
812 } else {
813 THROW_(array_exception, "Arrays must be homogenous.");
814 }
815 }
◆ insert() [2/3]
Insert a value into the array
Definition at line 798 of file cpptoml.h.
798 {
800 return values_.insert(position, value);
801 } else {
802 THROW_(array_exception, "Arrays must be homogenous.");
803 }
804 }
◆ insert() [3/3]
Convenience function for inserting a simple element in the array
Definition at line 821 of file cpptoml.h.
821 {
823 }
iterator insert(iterator position, const std::shared_ptr< value< T > > &value)
std::shared_ptr< typename value_traits< T >::type > make_value(T &&val)
◆ is_array()
MBool cpptoml::array::is_array |
( |
| ) |
const |
|
inlineoverridevirtual |
Determines if the TOML element is an array of "leaf" elements.
Reimplemented from cpptoml::base.
Definition at line 679 of file cpptoml.h.
◆ 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.
Definition at line 750 of file cpptoml.h.
750 {
751 std::vector<std::shared_ptr<array>> result(
values_.size());
752
754 [&](const std::shared_ptr<base>& v) -> std::shared_ptr<array> {
755 if(v->is_array()) return std::static_pointer_cast<array>(v);
756 return std::shared_ptr<array>{};
757 });
758
759 return result;
760 }
◆ operator=()
array & cpptoml::array::operator= |
( |
const array & |
obj | ) |
|
|
delete |
◆ push_back() [1/3]
void cpptoml::array::push_back |
( |
const std::shared_ptr< array > & |
val | ) |
|
|
inline |
Add an array to the end of the array
Definition at line 777 of file cpptoml.h.
777 {
780 } else {
781 THROW_(array_exception, "Arrays must be homogenous.");
782 }
783 }
◆ push_back() [2/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
Definition at line 766 of file cpptoml.h.
766 {
769 } else {
770 THROW_(array_exception, "Arrays must be homogenous.");
771 }
772 }
◆ push_back() [3/3]
Convenience function for adding a simple element to the end of the array.
Definition at line 790 of file cpptoml.h.
790 {
792 }
void push_back(const std::shared_ptr< value< T > > &val)
◆ reserve()
Reserve space for n values.
Definition at line 838 of file cpptoml.h.
◆ make_array
std::shared_ptr< array > make_array |
( |
| ) |
|
|
friend |
Definition at line 873 of file cpptoml.h.
873 {
874#if not defined(MAIA_INTEL_COMPILER)
875 struct make_shared_enabler :
public array {
876 make_shared_enabler() = default;
877 };
878
879 return std::make_shared<make_shared_enabler>();
880#else
881 return std::make_shared<ARRAY_::make_shared_enabler>();
882#endif
883}
◆ values_
std::vector<std::shared_ptr<base> > cpptoml::array::values_ |
|
private |
The documentation for this class was generated from the following file:
- /home/gitlab-runner/scratch/builds/oxpnswJ6/1/aia/m-AIA/m-AIA/src/IO/cpptoml.h