summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-05-13 21:57:48 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-05-13 21:57:48 (GMT)
commit27d7cb1c99a55bfb45658b4f20f901926e526cae (patch)
treeb650af0f9aa85fa2ec61637e0ac36b8a01d64e99 /Swiften/Base
parent7a4a9e1ed5733a6517124edf3c4bd55e87188dde (diff)
downloadswift-contrib-27d7cb1c99a55bfb45658b4f20f901926e526cae.zip
swift-contrib-27d7cb1c99a55bfb45658b4f20f901926e526cae.tar.bz2
Refactored OutgoingAdHocCommandSession a bit.
Diffstat (limited to 'Swiften/Base')
-rw-r--r--Swiften/Base/Algorithm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/Swiften/Base/Algorithm.h b/Swiften/Base/Algorithm.h
index ea9530b..4d7f1de 100644
--- a/Swiften/Base/Algorithm.h
+++ b/Swiften/Base/Algorithm.h
@@ -93,6 +93,17 @@ namespace Swift {
target.insert(target.end(), source.begin(), source.end());
}
+ template<typename A, typename B, typename C, typename D>
+ B get(const std::map<A, B, C, D>& map, const A& key, const B& defaultValue) {
+ typename std::map<A, B, C, D>::const_iterator i = map.find(key);
+ if (i != map.end()) {
+ return i->second;
+ }
+ else {
+ return defaultValue;
+ }
+ }
+
/*
* Functors
*/