summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/GenericElementParser.h')
-rw-r--r--Swiften/Parser/GenericElementParser.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/Swiften/Parser/GenericElementParser.h b/Swiften/Parser/GenericElementParser.h
new file mode 100644
index 0000000..e1b9cf7
--- /dev/null
+++ b/Swiften/Parser/GenericElementParser.h
@@ -0,0 +1,43 @@
+#ifndef SWIFTEN_GenericElementParser_H
+#define SWIFTEN_GenericElementParser_H
+
+#include <boost/shared_ptr.hpp>
+
+#include "Swiften/Parser/ElementParser.h"
+
+namespace Swift {
+ class String;
+ class PayloadParserFactoryCollection;
+
+ template<typename ElementType>
+ class GenericElementParser : public ElementParser {
+ public:
+ GenericElementParser() {
+ stanza_ = boost::shared_ptr<ElementType>(new ElementType());
+ }
+
+ virtual boost::shared_ptr<Element> getElement() const {
+ return stanza_;
+ }
+
+ protected:
+ virtual boost::shared_ptr<ElementType> getElementGeneric() const {
+ return stanza_;
+ }
+
+ private:
+ virtual void handleStartElement(const String&, const String&, const AttributeMap&) {
+ }
+
+ virtual void handleEndElement(const String&, const String&) {
+ }
+
+ virtual void handleCharacterData(const String&) {
+ }
+
+ private:
+ boost::shared_ptr<ElementType> stanza_;
+ };
+}
+
+#endif