diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-08-22 08:55:08 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-08-24 17:10:23 (GMT) |
commit | b6a34463dfcedd454ab42230a47cdb7294a76f21 (patch) | |
tree | 832b0243325451932c0d15e9e33d53948fce0110 /Swiften/Avatars/AvatarMemoryStorage.h | |
parent | 6e4b357141a6d09632f1e96d0eaf54f79daf52c9 (diff) | |
download | swift-b6a34463dfcedd454ab42230a47cdb7294a76f21.zip swift-b6a34463dfcedd454ab42230a47cdb7294a76f21.tar.bz2 |
Implemented VCardManager.
Diffstat (limited to 'Swiften/Avatars/AvatarMemoryStorage.h')
-rw-r--r-- | Swiften/Avatars/AvatarMemoryStorage.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Swiften/Avatars/AvatarMemoryStorage.h b/Swiften/Avatars/AvatarMemoryStorage.h new file mode 100644 index 0000000..f60f603 --- /dev/null +++ b/Swiften/Avatars/AvatarMemoryStorage.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2010 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <map> + +#include "Swiften/Base/String.h" +#include "Swiften/Base/ByteArray.h" +#include "Swiften/Avatars/AvatarStorage.h" + +namespace Swift { + class AvatarMemoryStorage : public AvatarStorage { + public: + virtual bool hasAvatar(const String& hash) const { return avatars.find(hash) != avatars.end(); } + virtual void addAvatar(const String& hash, const ByteArray& avatar) { avatars[hash] = avatar; } + virtual ByteArray getAvatar(const String& hash) const { + std::map<String, ByteArray>::const_iterator i = avatars.find(hash); + return i == avatars.end() ? ByteArray() : i->second; + } + + virtual boost::filesystem::path getAvatarPath(const String& hash) const { + return boost::filesystem::path(); + } + + private: + std::map<String, ByteArray> avatars; + }; +} |