• Main Page
  • Classes
  • Files
  • File List

Swiften/Disco/CapsMemoryStorage.h

00001 /*
00002  * Copyright (c) 2010 Remko Tronçon
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <boost/shared_ptr.hpp>
00010 #include <map>
00011 
00012 #include <string>
00013 #include <Swiften/Disco/CapsStorage.h>
00014 
00015 namespace Swift {
00016   class CapsMemoryStorage : public CapsStorage {
00017     public:
00018       CapsMemoryStorage() {}
00019 
00020       virtual DiscoInfo::ref getDiscoInfo(const std::string& hash) const {
00021         CapsMap::const_iterator i = caps.find(hash);
00022         if (i != caps.end()) {
00023           return i->second;
00024         }
00025         else {
00026           return DiscoInfo::ref();
00027         }
00028       }
00029 
00030       virtual void setDiscoInfo(const std::string& hash, DiscoInfo::ref discoInfo) {
00031         caps[hash] = discoInfo;
00032       }
00033 
00034     private:
00035       typedef std::map<std::string, DiscoInfo::ref> CapsMap;
00036       CapsMap caps;
00037   };
00038 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1