diff options
author | Thilo Cestonaro <thilo@cestona.ro> | 2011-09-28 22:03:14 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2011-12-13 08:17:58 (GMT) |
commit | fd17fe0d239f97cedebe4ceffa234155bd299b68 (patch) | |
tree | 010ae5155e6e807b548861304657a25699487e1f /Swiften/Parser/BOSHParser.h | |
parent | 7d19f0d81371d86d530d0e7083a04db914ce6745 (diff) | |
download | swift-contrib-fd17fe0d239f97cedebe4ceffa234155bd299b68.zip swift-contrib-fd17fe0d239f97cedebe4ceffa234155bd299b68.tar.bz2 |
BOSH implementation started
License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swiften/Parser/BOSHParser.h')
-rw-r--r-- | Swiften/Parser/BOSHParser.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Swiften/Parser/BOSHParser.h b/Swiften/Parser/BOSHParser.h new file mode 100644 index 0000000..69b3d13 --- /dev/null +++ b/Swiften/Parser/BOSHParser.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2011 Thilo Cestonaro + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <boost/noncopyable.hpp> + +#include <Swiften/Parser/XMLParserClient.h> +#include <Swiften/Parser/AttributeMap.h> + +namespace Swift { + class XMLParser; + + class BOSHParser : public XMLParserClient, boost::noncopyable { + public: + BOSHParser(); + ~BOSHParser(); + + bool parse(const std::string&); + + std::string getAttribute(const std::string& attribute, const std::string& ns = "") const { + return boshBodyAttributes_.getAttribute(attribute, ns); + } + private: + virtual void handleStartElement( + const std::string& element, + const std::string& ns, + const AttributeMap& attributes); + virtual void handleEndElement(const std::string& element, const std::string& ns); + virtual void handleCharacterData(const std::string& data); + + private: + AttributeMap boshBodyAttributes_; + XMLParser* xmlParser_; + enum Level { + BoshTopLevel = -1, + TopLevel = 0, + StreamLevel = 1, + ElementLevel = 2 + }; + int level_; + bool parseErrorOccurred_; + }; +} |