13 #include <boost/lexical_cast.hpp>
18 namespace ns_namevalue2
76 boost::lexical_cast<std::string>(
back().
index_),
112 if (
back().isArray())
140 #define ARILES2_BASIC_TYPE(type) \
141 void Writer::writeElement(const type &element, const Writer::Parameters &) \
143 if (index_ == name_value_pairs_->size()) \
145 name_value_pairs_->resize(index_ + 1); \
147 if (initialize_names_) \
149 name_value_pairs_->name(index_) = back().node_; \
150 if (back().isArray()) \
152 name_value_pairs_->name(index_) += "_"; \
153 name_value_pairs_->name(index_) += boost::lexical_cast<std::string>(back().index_); \
156 name_value_pairs_->value(index_) = element; \
162 #undef ARILES2_BASIC_TYPE
174 parameters.sloppy_maps_ =
true;
175 parameters.sloppy_pairs_ =
true;
176 parameters.explicit_matrix_size_ =
false;
177 parameters.fallback_to_string_floats_ =
false;
178 parameters.flat_matrices_ =
false;
179 parameters.allow_missing_entries_ =
true;
181 parameters.persistent_structure_ =
false;
void flush()
Flush the configuration to the output.
virtual void endMap()
Ends a nested map in the configuration file.
virtual void startArray(const std::size_t size, const bool=false)
const std::string bracket_right_
const std::string separator_
const std::string bracket_left_
virtual void startMap(const Parameters &, const std::size_t num_entries)
Starts a nested map in the configuration file.
virtual void endMapEntry()
virtual void endArrayElement()
virtual bool startIteratedMap(const std::size_t, const Parameters &)
std::shared_ptr< NameValueContainer > name_value_pairs_
virtual void startRoot(const std::string &name, const Parameters ¶m)
virtual void startMapEntry(const std::string &map_name)
Starts a nested map in the configuration file.
Writer(const std::shared_ptr< NameValueContainer > &container, const std::size_t reserve=0)
serialization::Node< std::string > & back()
std::string concatWithNode(t_String &&...strings) const
void emplace(t_Args &&...args)
void concatWithNodeAndEmplace(t_String &&...strings)
virtual const t_Parameters & getDefaultParameters() const
void writeElement(const std::complex< t_Scalar > &entry, const Parameters ¶m)
#define ARILES2_BASIC_NUMERIC_TYPES_LIST
CPPUT_MACRO_SUBSTITUTE(ARILES2_BASIC_NUMERIC_TYPES_LIST) void Writer
std::string reserve(t_String &&...strings)
#define CPPUT_TRACE_FUNCTION