From 302565043bed0dc68bbe5e86ab94d94b15e43424 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 9 Jan 2015 15:25:13 +0100 Subject: Added RTTI information for XML classes, made children vector of XML elements private and added name printout to Manager debug graphviz function. --- src/core/XML.hpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/core/XML.hpp') diff --git a/src/core/XML.hpp b/src/core/XML.hpp index b4b803d..25c8dae 100644 --- a/src/core/XML.hpp +++ b/src/core/XML.hpp @@ -45,6 +45,7 @@ #include #include +#include #include #include @@ -101,19 +102,22 @@ public: * Additionally it might have other Nodes as children. */ class Element : public Node { +private: + ManagedVector children; + public: const std::string name; std::map attributes; - ManagedVector children; Element(Manager &mgr, Handle parent, std::string name) - : Node(mgr, parent), name(std::move(name)) + : Node(mgr, parent), children(this), name(std::move(name)) { } Element(Manager &mgr, Handle parent, std::string name, std::map attributes) : Node(mgr, parent), + children(this), name(std::move(name)), attributes(std::move(attributes)) { @@ -127,6 +131,15 @@ public: * */ void doSerialize(std::ostream &out, unsigned int tabdepth) override; + + const ManagedVector &getChildren() const { return children; } + + void addChild(Handle child) { children.push_back(child); } + + void addChildren(std::vector> c) + { + children.insert(children.end(), c.begin(), c.end()); + } }; class Text : public Node { @@ -145,5 +158,11 @@ public: void doSerialize(std::ostream &out, unsigned int tabdepth) override; }; } + +namespace RttiTypes { +extern const Rtti XMLNode; +extern const Rtti XMLElement; +extern const Rtti XMLText; +} } #endif -- cgit v1.2.3