diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-03-03 21:11:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-03-03 22:14:49 (GMT) |
commit | 12024229138787d7df91cb8101d0986996880e3d (patch) | |
tree | 575ef4bd2104ce4a0531580ac78381dbb94f6c6e /Swiften/Parser/PayloadParsers | |
parent | a8cd6a5cbf74d0db4df0b7daa8e4b1b0e0bc00d0 (diff) | |
download | swift-contrib-12024229138787d7df91cb8101d0986996880e3d.zip swift-contrib-12024229138787d7df91cb8101d0986996880e3d.tar.bz2 |
Some more Sluift tweaks.
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
4 files changed, 14 insertions, 4 deletions
diff --git a/Swiften/Parser/PayloadParsers/CommandParser.cpp b/Swiften/Parser/PayloadParsers/CommandParser.cpp index 9422170..3ebab39 100644 --- a/Swiften/Parser/PayloadParsers/CommandParser.cpp +++ b/Swiften/Parser/PayloadParsers/CommandParser.cpp @@ -5,6 +5,9 @@ */ #include "Swiften/Parser/PayloadParsers/CommandParser.h" + +#include <boost/cast.hpp> + #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -43,7 +46,7 @@ void CommandParser::handleStartElement(const std::string& element, const std::st else if (level_ == FormOrNoteOrActionsLevel) { assert(!formParser_); if (formParserFactory_->canParse(element, ns, attributes)) { - formParser_ = dynamic_cast<FormParser*>(formParserFactory_->createPayloadParser()); + formParser_ = boost::polymorphic_downcast<FormParser*>(formParserFactory_->createPayloadParser()); assert(formParser_); } else if (element == "note") { diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp index 2ec1916..56995d8 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp @@ -5,6 +5,9 @@ */ #include "Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.h" + +#include <boost/cast.hpp> + #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -24,7 +27,7 @@ void InBandRegistrationPayloadParser::handleStartElement(const std::string& elem else if (level == PayloadLevel) { if (element == "x" && ns == "jabber:x:data") { assert(!formParser); - formParser = dynamic_cast<FormParser*>(formParserFactory->createPayloadParser()); + formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser()); } else { currentText.clear(); diff --git a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp index 7c8752c..9daf842 100644 --- a/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/SearchPayloadParser.cpp @@ -5,6 +5,9 @@ */ #include "Swiften/Parser/PayloadParsers/SearchPayloadParser.h" + +#include <boost/cast.hpp> + #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -24,7 +27,7 @@ void SearchPayloadParser::handleStartElement(const std::string& element, const s else if (level == PayloadLevel) { if (element == "x" && ns == "jabber:x:data") { assert(!formParser); - formParser = dynamic_cast<FormParser*>(formParserFactory->createPayloadParser()); + formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser()); } else if (element == "item") { assert(!currentItem); diff --git a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp index 28c5cf5..1cf7fcf 100644 --- a/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp +++ b/Swiften/Parser/PayloadParsers/StreamInitiationParser.cpp @@ -7,6 +7,7 @@ #include "Swiften/Parser/PayloadParsers/StreamInitiationParser.h" #include <boost/lexical_cast.hpp> +#include <boost/cast.hpp> #include "Swiften/Parser/PayloadParsers/FormParserFactory.h" #include "Swiften/Parser/PayloadParsers/FormParser.h" @@ -54,7 +55,7 @@ void StreamInitiationParser::handleStartElement(const std::string& element, cons } else if (inFeature && formParserFactory->canParse(element, ns, attributes)) { assert(!formParser); - formParser = dynamic_cast<FormParser*>(formParserFactory->createPayloadParser()); + formParser = boost::polymorphic_downcast<FormParser*>(formParserFactory->createPayloadParser()); } } |