diff options
Diffstat (limited to 'server/src/macrotool')
-rw-r--r-- | server/src/macrotool/dump.cc | 20 | ||||
-rw-r--r-- | server/src/macrotool/filehandler.cc | 11 |
2 files changed, 14 insertions, 17 deletions
diff --git a/server/src/macrotool/dump.cc b/server/src/macrotool/dump.cc index b567768..3d28181 100644 --- a/server/src/macrotool/dump.cc +++ b/server/src/macrotool/dump.cc @@ -104,12 +104,12 @@ static std::map<std::string, struct _macro> macroList() parser.parse(); Macro *macro = parser.getMacro(); - std::string key = macro->attributes["name"];// + "-" + macro->attributes["version"]; - macros[key].name = macro->attributes["name"]; + std::string key = macro->name;// + "-" + macro->version; + macros[key].name = macro->name; macros[key].file = *mfs; macros[key].title = macro->widgets.attributes["caption"]; macros[key].fields = getFields(macro->widgets); - macros[key].version = macro->attributes["version"]; + macros[key].version = macro->version; } catch( Exception &e ) { printf("Skipping: %s: %s\n", mfs->c_str(), e.what()); } @@ -127,8 +127,7 @@ static std::map<std::string, struct _macro> macroList() Template *t = parser.getTemplate(); std::vector<Macro>::iterator ms = t->macros.begin(); while(ms != t->macros.end()) { - if(ms->attributes.find("header") == ms->attributes.end()) - macros[ms->attributes["name"]].templates.insert(templ); + if(ms->isHeader) macros[ms->name].templates.insert(templ); ms++; } } catch( Exception &e ) { @@ -234,17 +233,16 @@ static std::map<std::string, struct _template> templateList() parser.parse(); Template *t = parser.getTemplate(); - std::string key = t->attributes["name"]; + std::string key = t->name; templates[key].file = *tfs; - templates[key].name = t->attributes["name"]; - templates[key].title = t->attributes["title"]; - templates[key].version = t->attributes["version"]; + templates[key].name = t->name; + templates[key].title = t->title; + templates[key].version = t->version; std::vector<Macro>::iterator ms = t->macros.begin(); while(ms != t->macros.end()) { - if(ms->attributes.find("header") == ms->attributes.end()) - templates[key].macros.push_back(ms->attributes["name"]); + if(ms->isHeader) templates[key].macros.push_back(ms->name); ms++; } } catch( Exception &e ) { diff --git a/server/src/macrotool/filehandler.cc b/server/src/macrotool/filehandler.cc index 3c80a1c..738b687 100644 --- a/server/src/macrotool/filehandler.cc +++ b/server/src/macrotool/filehandler.cc @@ -74,11 +74,11 @@ static bool check(std::string file, std::string *name, std::string *version) } printf("Parsing of %s was succesful.\n", file.c_str()); - printf("Name: %s\n", macro->attributes["name"].c_str()); - printf("Version: %s\n", macro->attributes["version"].c_str()); + printf("Name: %s\n", macro->name.c_str()); + printf("Version: %s\n", macro->version.c_str()); - if(name) *name = macro->attributes["name"]; - if(version) *version = macro->attributes["version"]; + if(name) *name = macro->name; + if(version) *version = macro->version; } catch( std::exception &e ) { printf("%s\n", e.what()); @@ -102,8 +102,7 @@ static bool macro_exists(std::string name, std::string version, std::string &cla parser.parse(); Macro *macro = parser.getMacro(); - if(name == macro->attributes["name"] && - version == macro->attributes["version"]) { + if(name == macro->name && version == macro->version) { clashfile = *mfs; return true; } |