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/macroparser.cc | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'server/src/macroparser.cc') diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc index bf6ff13..d1604b2 100644 --- a/server/src/macroparser.cc +++ b/server/src/macroparser.cc @@ -118,8 +118,7 @@ void MacroParser::characterData(std::string &data) } } -void MacroParser::startTag(std::string name, - std::map< std::string, std::string> attributes) +void MacroParser::startTag(std::string name, attributes_t &attr) { // Create macro and enable parsing of queries, maps and widgets if(name == "macro") { @@ -129,7 +128,9 @@ void MacroParser::startTag(std::string name, assert(!m); // A Macro has already been allocated, cannot create macro! m = new Macro(); - m->attributes = attributes; + + if(attr.find("name") != attr.end()) m->name = attr["name"]; + if(attr.find("version") != attr.end()) m->version = attr["version"]; return; } @@ -139,7 +140,7 @@ void MacroParser::startTag(std::string name, if(state != MACRO) error("resume found outside macro."); state = RESUME; - m->resume.attributes = attributes; + m->resume.attributes = attr; assert(m); // No macro is currently available, cannot create resume! @@ -164,7 +165,7 @@ void MacroParser::startTag(std::string name, assert(m); // No macro is currently available, cannot create query! Query q; - q.attributes = attributes; + q.attributes = attr; m->queries.push_back(q); return; @@ -188,7 +189,7 @@ void MacroParser::startTag(std::string name, assert(m); // No macro is currently available, cannot create map! Map map; - map.attributes = attributes; + map.attributes = attr; m->maps.push_back(map); current_map = &(m->maps.back()); @@ -216,7 +217,7 @@ void MacroParser::startTag(std::string name, state = SCRIPT; Script s; - s.attributes = attributes; + s.attributes = attr; m->scripts.push_back(s); current_script = &(m->scripts.back()); } @@ -226,7 +227,7 @@ void MacroParser::startTag(std::string name, state = RESUME_SCRIPT; Script s; - s.attributes = attributes; + s.attributes = attr; m->resume_scripts.push_back(s); current_resume_script = &(m->resume_scripts.back()); } @@ -246,7 +247,7 @@ void MacroParser::startTag(std::string name, assert(m); // No macro is currently available, cannot create widgets! - m->widgets.attributes = attributes; + m->widgets.attributes = attr; m->widgets.attributes["tagname"] = name; Widget *current = &(m->widgets); @@ -262,7 +263,7 @@ void MacroParser::startTag(std::string name, assert(widgetstack.size()); // Widget stack is empty, cannot create! Widget w; - w.attributes = attributes; + w.attributes = attr; w.attributes["tagname"] = name; Widget *parent = widgetstack.back(); -- cgit v1.2.3