34 return (
back().node_);
48 impl_ = std::make_shared<impl::Reader>();
50 const pugi::xml_parse_result result =
impl_->document_.load_file(file_name.c_str(), pugi::parse_minimal);
51 CPPUT_ASSERT(result, std::string(
"Parsing of '") + file_name +
"' failed: " + result.description());
52 impl_->node_stack_.emplace_back(
impl_->document_);
58 impl_ = std::make_shared<impl::Reader>();
60 const pugi::xml_parse_result result =
impl_->document_.load(input_stream, pugi::parse_minimal);
61 CPPUT_ASSERT(result, std::string(
"Parsing failed: ") + result.description());
62 impl_->node_stack_.emplace_back(
impl_->document_);
68 const pugi::xml_node child =
impl_->getRawNode().child(child_name.c_str());
72 impl_->emplace(child);
76 const pugi::xml_attribute attribute =
impl_->getRawNode().attribute(child_name.c_str());
77 if (
nullptr != attribute)
79 const pugi::xml_node new_child =
impl_->getRawNode().append_child(child_name.c_str());
80 new_child.text() = attribute.value();
81 impl_->emplace(new_child);
100 const pugi::xml_node child =
impl_->getRawNode().first_child();
101 if (
nullptr != child)
111 if (
nullptr !=
impl_->getRawNode())
113 entry_name =
impl_->getRawNode().name();
121 const pugi::xml_node node =
impl_->getRawNode();
124 impl_->getRawNode() = node.next_sibling();
137 std::size_t size = 0;
138 const pugi::xml_node node =
impl_->getRawNode();
139 for (pugi::xml_node child = node.child(
"item");
nullptr != child;
140 child = child.next_sibling(
"item"), ++size)
146 impl_->emplace(node.child(
"item"), 0, size);
153 for (pugi::xml_node child =
impl_->getRawNode();
nullptr != child;
154 child = child.next_sibling(child.name()), ++size)
168 "Internal error: array has more elements than expected.");
175 impl_->back().node_ =
impl_->getRawNode().next_sibling(
impl_->getRawNode().name());
176 ++
impl_->back().index_;
205 element =
impl_->getRawNode().text().as_string();
209 #define ARILES2_BASIC_TYPE(type) \
210 void Reader::readElement(type &element) \
212 CPPUT_ASSERT(not impl_->getRawNode().text().empty(), "Empty integer elements are not allowed."); \
213 element = boost::lexical_cast<type>(impl_->getRawNode().text().as_string()); \
218 #undef ARILES2_BASIC_TYPE
void endRoot(const std::string &name)
bool startIteratedMap(const SizeLimitEnforcementType=SIZE_LIMIT_NONE, const std::size_t=0, const std::size_t=0)
bool startRoot(const std::string &name)
Reader(const std::string &file_name)
Constructor.
void endIteratedMapElement()
bool startMapEntry(const std::string &child_name)
startMapEntry to the entry with the given name
bool startIteratedMapElement(std::string &entry_name)
void endMapEntry()
endMapEntry from the current entry to its parent.
pugi::xml_node & getRawNode()
Get current node.
pugi::xml_document document_
void readElement(std::complex< t_Scalar > &entry)
#define CPPUT_ASSERT(condition,...)
#define ARILES2_BASIC_NUMERIC_TYPES_LIST
#define CPPUT_MACRO_SUBSTITUTE(macro)
#define CPPUT_TRACE_FUNCTION