summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-18 18:22:51 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-18 18:22:51 +0100
commit0463affed4d6ca08c0554974130aba83af13efa5 (patch)
treee747076b29d4765eca401ec8fc50cb5dd343ba5c /src/plugins
parenta30e627ffccf36384689295ce54af32e38ef5ef8 (diff)
Parsing struct attributes, added ability to reference other typesystems from a typesystem
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/xml/XmlParser.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/plugins/xml/XmlParser.cpp b/src/plugins/xml/XmlParser.cpp
index cd220a9..bcac7d3 100644
--- a/src/plugins/xml/XmlParser.cpp
+++ b/src/plugins/xml/XmlParser.cpp
@@ -93,7 +93,7 @@ public:
// Try to resolve the parent type and set it as parent structure
if (!parent.empty()) {
- scope().resolve<StructType>(Utils::split(parent, '.'), logger(),
+ scope().resolve<StructType>(parent, logger(),
[structType](Handle<StructType> parent,
Logger &logger) mutable {
structType->setParentStructure(
@@ -125,13 +125,22 @@ public:
void start(Variant::mapType &args) override
{
// Read the argument values
- /* const std::string &name = args["name"].asString();
- const std::string &type = args["parent"].asString();
- const Variant &defaultValue = args["default"];
- const bool optional = !(defaultValue.isObject() &&
- defaultValue.asObject() == nullptr);*/
-
- // Try to resolve the
+ const std::string &name = args["name"].asString();
+ const std::string &type = args["type"].asString();
+ const Variant &defaultValue = args["default"];
+ const bool optional =
+ !(defaultValue.isObject() && defaultValue.asObject() == nullptr);
+
+ Rooted<StructType> structType = scope().getLeaf().cast<StructType>();
+ Rooted<Attribute> attribute = structType->createAttribute(
+ name, defaultValue, optional, logger());
+
+ // Try to resolve the type
+ scope().resolve<Type>(type, logger(),
+ [attribute](Handle<Type> type, Logger &logger) mutable {
+ attribute->setType(type, logger);
+ },
+ location());
}
void end() override {}