summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser/Tree')
-rw-r--r--Swiften/Parser/Tree/ParserElement.cpp17
-rw-r--r--Swiften/Parser/Tree/ParserElement.h3
2 files changed, 8 insertions, 12 deletions
diff --git a/Swiften/Parser/Tree/ParserElement.cpp b/Swiften/Parser/Tree/ParserElement.cpp
index 9d9b9b6..e5f8bc8 100644
--- a/Swiften/Parser/Tree/ParserElement.cpp
+++ b/Swiften/Parser/Tree/ParserElement.cpp
@@ -10,4 +10,8 @@
#include <iostream>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+
+namespace lambda = boost::lambda;
namespace Swift {
@@ -29,17 +33,8 @@ void ParserElement::appendCharacterData(const std::string& data) {
}
-struct DoesntMatch {
- public:
- DoesntMatch(const std::string& tagName, const std::string& ns) : tagName(tagName), ns(ns) {}
- bool operator()(ParserElement::ref element) { return element->getName() != tagName || element->getNamespace() != ns; }
- private:
- std::string tagName;
- std::string ns;
-};
-
-
std::vector<ParserElement::ref> ParserElement::getChildren(const std::string& name, const std::string& xmlns) const {
std::vector<ParserElement::ref> result;
- std::remove_copy_if(children_.begin(), children_.end(), std::back_inserter(result), DoesntMatch(name, xmlns));
+ std::remove_copy_if(children_.begin(), children_.end(), std::back_inserter(result),
+ lambda::bind(&ParserElement::getName, *lambda::_1) != name || lambda::bind(&ParserElement::getNamespace, *lambda::_1) != xmlns);
return result;
}
diff --git a/Swiften/Parser/Tree/ParserElement.h b/Swiften/Parser/Tree/ParserElement.h
index b268c76..6be0631 100644
--- a/Swiften/Parser/Tree/ParserElement.h
+++ b/Swiften/Parser/Tree/ParserElement.h
@@ -10,4 +10,5 @@
#include <string>
#include <vector>
+#include <Swiften/Base/API.h>
#include <Swiften/Base/boost_bsignals.h>
#include <Swiften/Parser/AttributeMap.h>
@@ -16,5 +17,5 @@
namespace Swift {
- class ParserElement {
+ class SWIFTEN_API ParserElement {
public:
typedef boost::shared_ptr<ParserElement> ref;