• Main Page
  • Classes
  • Files
  • File List

Swiften/VCards/VCardMemoryStorage.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 <Swiften/JID/JID.h>
00013 #include <Swiften/VCards/VCardStorage.h>
00014 
00015 namespace Swift {
00016   class VCardMemoryStorage : public VCardStorage {
00017     public:
00018       VCardMemoryStorage() {}
00019 
00020       virtual VCard::ref getVCard(const JID& jid) const {
00021         VCardMap::const_iterator i = vcards.find(jid);
00022         if (i != vcards.end()) {
00023           return i->second;
00024         }
00025         else {
00026           return VCard::ref();
00027         }
00028       }
00029 
00030       virtual void setVCard(const JID& jid, VCard::ref v) {
00031         vcards[jid] = v;
00032       }
00033 
00034     private:
00035       typedef std::map<JID, VCard::ref> VCardMap;
00036       VCardMap vcards;
00037   };
00038 }

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