summaryrefslogtreecommitdiff
path: root/server/src/templateparser.cc
diff options
context:
space:
mode:
authordeva <deva>2009-07-30 08:36:12 +0000
committerdeva <deva>2009-07-30 08:36:12 +0000
commit77272458e7a8906d871b241b5385bbd0f783d861 (patch)
tree7e32f988654c042be251c4ba31b72902402059f3 /server/src/templateparser.cc
parent1f8c58836dfd8dc8c9a0abeeaef6789325189f1b (diff)
Removed the term 'course' everywhere, and replaced it by 'template'. This reduced/simplified the Template class structure a bit.
Diffstat (limited to 'server/src/templateparser.cc')
-rw-r--r--server/src/templateparser.cc33
1 files changed, 15 insertions, 18 deletions
diff --git a/server/src/templateparser.cc b/server/src/templateparser.cc
index 8ddf6d2..62be9c7 100644
--- a/server/src/templateparser.cc
+++ b/server/src/templateparser.cc
@@ -63,7 +63,7 @@ TemplateParser::TemplateParser(std::string templatefile)
t = new Template();
current_macro = NULL;
- file = templatefile;//Conf::xml_basedir + "/templates/" + course + ".xml";
+ file = templatefile;
PRACRO_DEBUG(macro, "Using template file: %s\n", file.c_str());
@@ -84,20 +84,20 @@ void TemplateParser::characterData(std::string &data)
void TemplateParser::startTag(std::string name, std::map< std::string, std::string> attributes)
{
// Enable macro parsing
- if(name == "course") {
- if(state != UNDEFINED) error("course found not a root node.");
- state = COURSE;
+ if(name == "template") {
+ if(state != UNDEFINED) error("Template found not a root node.");
+ state = TEMPLATE;
- assert(t); // A Template has not yet been allocated, cannot create course!
+ assert(t); // A Template has not yet been allocated, cannot create template!
- t->course.attributes = attributes;
+ t->attributes = attributes;
return;
}
// Create macro and enable parsing of queries, maps and window
if(name == "macro" || name == "header") {
- if(state != COURSE) error("macro found outside course.");
+ if(state != TEMPLATE) error("macro found outside template.");
state = MACRO;
assert(t); // A Template has not yet been allocated, cannot create macro!
@@ -105,8 +105,8 @@ void TemplateParser::startTag(std::string name, std::map< std::string, std::stri
Macro m;
m.attributes = attributes;
m.isHeader = name == "header";
- t->course.macros.push_back(m);
- current_macro = &(t->course.macros.back());
+ t->macros.push_back(m);
+ current_macro = &(t->macros.back());
return;
}
@@ -116,10 +116,10 @@ void TemplateParser::startTag(std::string name, std::map< std::string, std::stri
void TemplateParser::endTag(std::string name)
{
- if(name == "course") state = UNDEFINED;
+ if(name == "template") state = UNDEFINED;
if(name == "macro" || name == "header") {
current_macro = NULL;
- state = COURSE;
+ state = TEMPLATE;
}
}
@@ -173,16 +173,13 @@ int main()
Template *t = parser.getTemplate();
- printf("[Template]:\n");
- print_attributes("\t-", t->attributes);
-
- printf("\t[Course]:\n");
- print_attributes("\t\t-", t->course.attributes);
+ printf("\t[Template]:\n");
+ print_attributes("\t\t-", t->attributes);
printf("\t\t[Macros]:\n");
- std::vector< Macro >::iterator i = t->course.macros.begin();
+ std::vector< Macro >::iterator i = t->macros.begin();
- while(i != t->course.macros.end()) {
+ while(i != t->macros.end()) {
printf("\t\t\t[Macro]:\n");
print_attributes("\t\t\t\t-", (*i).attributes);