diff options
Diffstat (limited to 'Swiften/Parser/PayloadParserFactoryCollection.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParserFactoryCollection.cpp | 31 |
2 files changed, 0 insertions, 31 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Parser/PayloadParserFactoryCollection.cpp b/Swiften/Parser/PayloadParserFactoryCollection.cpp deleted file mode 100644 index 6d3a4cf..0000000 --- a/Swiften/Parser/PayloadParserFactoryCollection.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include <boost/bind.hpp> -#include <algorithm> - -#include "Swiften/Parser/PayloadParserFactoryCollection.h" -#include "Swiften/Parser/PayloadParserFactory.h" - -namespace Swift { - -PayloadParserFactoryCollection::PayloadParserFactoryCollection() : defaultFactory_(NULL) { -} - -void PayloadParserFactoryCollection::addFactory(PayloadParserFactory* factory) { - factories_.push_back(factory); -} - -void PayloadParserFactoryCollection::removeFactory(PayloadParserFactory* factory) { - factories_.erase(remove(factories_.begin(), factories_.end(), factory), factories_.end()); -} - -void PayloadParserFactoryCollection::setDefaultFactory(PayloadParserFactory* factory) { - defaultFactory_ = factory; -} - -PayloadParserFactory* PayloadParserFactoryCollection::getPayloadParserFactory(const String& element, const String& ns, const AttributeMap& attributes) { - std::vector<PayloadParserFactory*>::reverse_iterator i = std::find_if( - factories_.rbegin(), factories_.rend(), - boost::bind(&PayloadParserFactory::canParse, _1, element, ns, attributes)); - return (i != factories_.rend() ? *i : defaultFactory_); -} - -} |