summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-14 22:04:34 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-14 22:04:34 +0100
commit682250084fdd162b86427e0c29af24696ad10eb1 (patch)
treea0978c957b38e3de52527902a95f4e4d5ca51233
parente72f5969db10d88818c2814c3929ddb67ddffc76 (diff)
Registered Properties for the XMLNode class
-rw-r--r--src/core/XML.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/XML.cpp b/src/core/XML.cpp
index 528e1cd..475e345 100644
--- a/src/core/XML.cpp
+++ b/src/core/XML.cpp
@@ -19,6 +19,7 @@
#include <sstream>
#include <core/common/Rtti.hpp>
+#include <core/common/TypedRttiBuilder.hpp>
#include "XML.hpp"
@@ -115,10 +116,18 @@ void Text::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty)
}
}
+static Variant getXmlElementName(const xml::Element *obj)
+{
+ return Variant::fromString(obj->name);
+}
+
namespace RttiTypes {
const Rtti<xml::Node> XMLNode = RttiBuilder("XMLNode");
const Rtti<xml::Element> XMLElement =
- RttiBuilder("XMLElement").parent(&XMLNode).composedOf(&XMLNode);
+ TypedRttiBuilder<xml::Element>("XMLElement")
+ .parent(&XMLNode)
+ .composedOf(&XMLNode)
+ .property("name", {RttiTypes::String, getXmlElementName});
const Rtti<xml::Text> XMLText = RttiBuilder("XMLText").parent(&XMLNode);
}
}