diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-14 00:08:52 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-14 00:08:52 +0100 |
commit | c6257435c8d09a672e16379731e8b75e0d01a82b (patch) | |
tree | 1b8cc7d5fc2db6aa3331395d5677cd1557a19d46 /src/core | |
parent | 8d7248592f5d40cfefac408af878c83793366caa (diff) |
added Element::getAttributes and changed newline characters in serialization to std::endl.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/XML.cpp | 10 | ||||
-rw-r--r-- | src/core/XML.hpp | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/core/XML.cpp b/src/core/XML.cpp index 722c490..0aedbd9 100644 --- a/src/core/XML.cpp +++ b/src/core/XML.cpp @@ -31,7 +31,7 @@ void Node::serialize(std::ostream &out, const std::string &doctype, bool pretty) if (doctype != "") { out << doctype; if (pretty) { - out << '\n'; + out << std::endl; } } doSerialize(out, 0, pretty); @@ -80,12 +80,12 @@ void Element::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty) if (children.size() == 0) { out << "/>"; if (pretty) { - out << '\n'; + out << std::endl; } } else { out << ">"; if (pretty) { - out << '\n'; + out << std::endl; } for (auto &n : children) { n->doSerialize(out, tabdepth + 1, pretty); @@ -97,7 +97,7 @@ void Element::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty) } out << "</" << name << ">"; if (pretty) { - out << '\n'; + out << std::endl; } } } @@ -111,7 +111,7 @@ void Text::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty) } out << escapePredefinedEntities(text); if (pretty) { - out << '\n'; + out << std::endl; } } } diff --git a/src/core/XML.hpp b/src/core/XML.hpp index 67489f1..a1021d3 100644 --- a/src/core/XML.hpp +++ b/src/core/XML.hpp @@ -150,6 +150,11 @@ public: { children.insert(children.end(), c.begin(), c.end()); } + + const std::map<std::string, std::string> &getAttributes() const + { + return attributes; + } }; class Text : public Node { @@ -176,4 +181,4 @@ extern const Rtti XMLElement; extern const Rtti XMLText; } } -#endif +#endif
\ No newline at end of file |