summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-17 17:15:10 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-17 17:15:10 +0100
commitfcc6a49d8124a0fe1130e242191cc3dc3d701309 (patch)
treea07a96509ff9a415d0f9f1265c754a5af77ba20c /src/core
parente8df5877aa9bbeeb34ab0fe13f41d8096919c748 (diff)
parent1bfa8739ed66a25397286ea8be98c3eeb1c695af (diff)
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'src/core')
-rw-r--r--src/core/XML.cpp14
-rw-r--r--src/core/XML.hpp25
-rw-r--r--src/core/model/Document.hpp10
3 files changed, 33 insertions, 16 deletions
diff --git a/src/core/XML.cpp b/src/core/XML.cpp
index 0aedbd9..e25d18a 100644
--- a/src/core/XML.cpp
+++ b/src/core/XML.cpp
@@ -71,7 +71,11 @@ void Element::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty)
out << '\t';
}
}
- out << '<' << name;
+ out << '<';
+ if(!nspace.empty()){
+ out << nspace << ":";
+ }
+ out << name;
for (auto &a : attributes) {
out << ' ' << a.first << "=\"" << escapePredefinedEntities(a.second)
<< '\"';
@@ -95,7 +99,11 @@ void Element::doSerialize(std::ostream &out, unsigned int tabdepth, bool pretty)
out << '\t';
}
}
- out << "</" << name << ">";
+ out << "</";
+ if(!nspace.empty()){
+ out << nspace << ":";
+ }
+ out << name << ">";
if (pretty) {
out << std::endl;
}
@@ -125,7 +133,7 @@ namespace RttiTypes
.composedOf(&XMLNode)
.property("name", {&RttiTypes::String,
{[](const xml::Element *obj) {
- return Variant::fromString(obj->name);
+ return Variant::fromString(obj->getName());
}}});
const Rtti XMLText = RttiBuilder<xml::Text>("XMLText").parent(&XMLNode);
}
diff --git a/src/core/XML.hpp b/src/core/XML.hpp
index a1021d3..02b0d89 100644
--- a/src/core/XML.hpp
+++ b/src/core/XML.hpp
@@ -113,22 +113,19 @@ public:
class Element : public Node {
private:
ManagedVector<Node> children;
-
-public:
- const std::string name;
std::map<std::string, std::string> attributes;
+ const std::string nspace;
+ const std::string name;
- Element(Manager &mgr, Handle<Element> parent, std::string name)
- : Node(mgr, parent), children(this), name(std::move(name))
- {
- }
-
+public:
Element(Manager &mgr, Handle<Element> parent, std::string name,
- std::map<std::string, std::string> attributes)
+ std::map<std::string, std::string> attributes = {},
+ std::string nspace = "")
: Node(mgr, parent),
children(this),
- name(std::move(name)),
- attributes(std::move(attributes))
+ attributes(std::move(attributes)),
+ nspace(std::move(nspace)),
+ name(std::move(name))
{
}
@@ -151,10 +148,16 @@ public:
children.insert(children.end(), c.begin(), c.end());
}
+ const std::string &getNamespace() const { return nspace; }
+
+ const std::string &getName() const { return name; }
+
const std::map<std::string, std::string> &getAttributes() const
{
return attributes;
}
+
+ std::map<std::string, std::string> &getAttributes() { return attributes; }
};
class Text : public Node {
diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp
index 6903bb3..a5e40ce 100644
--- a/src/core/model/Document.hpp
+++ b/src/core/model/Document.hpp
@@ -1014,6 +1014,13 @@ public:
}
/**
+ * Returns a const reference to the NodeVector of referenced Typesystems.
+ *
+ * @return a const reference to the NodeVector of referenced Typesystems.
+ */
+ const NodeVector<Typesystem> getTypesystems() const { return typesystems; }
+
+ /**
* Adds a Typesystem reference to this Document.
*/
void referenceTypesystem(Handle<Typesystem> d)
@@ -1031,7 +1038,6 @@ public:
typesystems.insert(typesystems.end(), d.begin(), d.end());
}
-
/**
* Returns true if and only if the given StructureNode is part of this
* document, meaning that there is a path of parent references in the
@@ -1055,4 +1061,4 @@ extern const Rtti Anchor;
}
}
-#endif /* _OUSIA_MODEL_DOCUMENT_HPP_ */
+#endif /* _OUSIA_MODEL_DOCUMENT_HPP_ */ \ No newline at end of file