diff options
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/macroheaderparser.h | 31 | ||||
-rw-r--r-- | server/src/templateheaderparser.h | 31 |
2 files changed, 62 insertions, 0 deletions
diff --git a/server/src/macroheaderparser.h b/server/src/macroheaderparser.h index 28c5578..0bc58ed 100644 --- a/server/src/macroheaderparser.h +++ b/server/src/macroheaderparser.h @@ -31,12 +31,40 @@ #include "saxparser.h" #include "template.h" +/** + * Partial macro parser. + * This class is used to parse only the first tag of a macro xml file. + * The parser will run about 10 times faster than the one parsing the entire file + * (see the MacroParser class) and can be used to make a list of which macros are in + * which files. + * This class inherits the SAXParser baseclass. + * Use the parse() method to run the parser, and collect the result via the + * getMacro() method. + * If the file does not contain a macro, or the files is not a valid xml file, an + * Exception will be thrown. + */ class MacroHeaderParser : public SAXParser { public: + /** + * Constructor. + * @param macrofile A std::string containing the name of the file to parse. + */ MacroHeaderParser(std::string macrofile); + + /** + * Destructor. + * Frees the allocated Macro* (if any). + */ ~MacroHeaderParser(); + /** + * Overloaded parser callback method. + */ void startTag(std::string name, std::map< std::string, std::string> attributes); + + /** + * Overloaded parser callback method. + */ void parseError(char *buf, size_t len, std::string error, int lineno); /** @@ -48,6 +76,9 @@ public: Macro *getMacro(); protected: + /** + * Overloaded parser callback method. + */ int readData(char *data, size_t size); private: diff --git a/server/src/templateheaderparser.h b/server/src/templateheaderparser.h index 522f56d..e517f67 100644 --- a/server/src/templateheaderparser.h +++ b/server/src/templateheaderparser.h @@ -31,12 +31,40 @@ #include "saxparser.h" #include "template.h" +/** + * Partial template parser. + * This class is used to parse only the first tag of a template xml file. + * The parser will run about 10 times faster than the one parsing the entire file + * (see the TemplateParser class) and can be used to make a list of which templates are in + * which files. + * This class inherits the SAXParser baseclass. + * Use the parse() method to run the parser, and collect the result via the + * getTemplate() method. + * If the file does not contain a template, or the files is not a valid xml file, an + * Exception will be thrown. + */ class TemplateHeaderParser : public SAXParser { public: + /** + * Constructor. + * @param templatefile A std::string containing the name of the file to parse. + */ TemplateHeaderParser(std::string templatefile); + + /** + * Destructor. + * Frees the allocated Template* (if any). + */ ~TemplateHeaderParser(); + /** + * Overloaded parser callback method. + */ void startTag(std::string name, std::map< std::string, std::string> attributes); + + /** + * Overloaded parser callback method. + */ void parseError(char *buf, size_t len, std::string error, int lineno); /** @@ -48,6 +76,9 @@ public: Template *getTemplate(); protected: + /** + * Overloaded parser callback method. + */ int readData(char *data, size_t size); private: |