diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/SearchPayloadParser.h')
-rw-r--r-- | Swiften/Parser/PayloadParsers/SearchPayloadParser.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.h b/Swiften/Parser/PayloadParsers/SearchPayloadParser.h new file mode 100644 index 0000000..55177b0 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> + +#include "Swiften/Elements/SearchPayload.h" +#include "Swiften/Parser/GenericPayloadParser.h" + +namespace Swift { + class FormParserFactory; + class FormParser; + + class SearchPayloadParser : public GenericPayloadParser<SearchPayload> { + public: + SearchPayloadParser(); + ~SearchPayloadParser(); + + virtual void handleStartElement(const String& element, const String&, const AttributeMap& attributes); + virtual void handleEndElement(const String& element, const String&); + virtual void handleCharacterData(const String& data); + + private: + enum Level { + TopLevel = 0, + PayloadLevel = 1, + ItemLevel = 2, + }; + int level; + FormParserFactory* formParserFactory; + FormParser* formParser; + String currentText; + boost::optional<SearchPayload::Item> currentItem; + }; +} |