00001
00002
00003
00004
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 }