summaryrefslogtreecommitdiff
path: root/server/src/macrotool_dump.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/macrotool_dump.cc')
-rw-r--r--server/src/macrotool_dump.cc70
1 files changed, 42 insertions, 28 deletions
diff --git a/server/src/macrotool_dump.cc b/server/src/macrotool_dump.cc
index d108e54..f570a15 100644
--- a/server/src/macrotool_dump.cc
+++ b/server/src/macrotool_dump.cc
@@ -42,6 +42,8 @@
#include "configuration.h"
+#include "exception.h"
+
struct _macro {
std::string name;
std::string title;
@@ -74,14 +76,18 @@ static std::map<std::string, struct _macro> macroList()
//std::string name = mfs->substr(0, mfs->length() - 4);
MacroParser parser(Conf::xml_basedir + "/macros/" + *mfs);
- parser.parse();
- Macro *macro = parser.getMacro();
-
- std::string key = macro->attributes["name"];// + "-" + macro->attributes["version"];
- macros[key].name = macro->attributes["name"];
- macros[key].file = *mfs;
- macros[key].title = macro->widgets.attributes["caption"];
- macros[key].version = macro->attributes["version"];
+ try {
+ parser.parse();
+ Macro *macro = parser.getMacro();
+
+ std::string key = macro->attributes["name"];// + "-" + macro->attributes["version"];
+ macros[key].name = macro->attributes["name"];
+ macros[key].file = *mfs;
+ macros[key].title = macro->widgets.attributes["caption"];
+ macros[key].version = macro->attributes["version"];
+ } catch( Exception &e ) {
+ printf("Skipping: %s: %s\n", mfs->c_str(), e.what());
+ }
mfs++;
}
@@ -91,14 +97,19 @@ static std::map<std::string, struct _macro> macroList()
while(tfs != templatefiles.end()) {
std::string templ = tfs->substr(0, tfs->length() - 4);
TemplateParser parser(Conf::xml_basedir + "/templates/" + *tfs);
- parser.parse();
- 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);
- ms++;
+ try {
+ parser.parse();
+ 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);
+ ms++;
+ }
+ } catch( Exception &e ) {
+ printf("Skipping: %s: %s\n", tfs->c_str(), e.what());
}
+
tfs++;
}
@@ -155,23 +166,26 @@ static std::map<std::string, struct _template> templateList()
std::vector<std::string>::iterator tfs = templatefiles.begin();
while(tfs != templatefiles.end()) {
TemplateParser parser(Conf::xml_basedir + "/templates/" + *tfs);
- parser.parse();
- Template *t = parser.getTemplate();
+ try {
+ parser.parse();
+ Template *t = parser.getTemplate();
- std::string key = t->attributes["name"];
+ std::string key = t->attributes["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].file = *tfs;
+ templates[key].name = t->attributes["name"];
+ templates[key].title = t->attributes["title"];
+ templates[key].version = t->attributes["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"]);
- ms++;
+ 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"]);
+ ms++;
+ }
+ } catch( Exception &e ) {
+ printf("Skipping: %s: %s\n", tfs->c_str(), e.what());
}
-
tfs++;
}