From 23f39df8b8edeacfa5821050abbdc855acb2edd6 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 1 Jul 2011 11:54:26 +0000 Subject: removed macrotool. add lua wrapper for praxisd. new type attributes_t for sax parser and children. make macros/templates use real vars instead of var map. add data ttl on macro level. add 'important' attribute to macrotags in templates. --- server/src/macrotool/dump.cc | 20 +++++++++----------- server/src/macrotool/filehandler.cc | 11 +++++------ 2 files changed, 14 insertions(+), 17 deletions(-) (limited to 'server/src/macrotool') 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 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 macroList() Template *t = parser.getTemplate(); std::vector::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 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::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; } -- cgit v1.2.3