#include "../include/GlobalCache.hpp" #include "../include/GtkGif.hpp" #include "../include/GtkScaledImage.hpp" namespace dchat { static Cache *cache = nullptr; Cache& getGlobalCache() { if(!cache) { auto createGifFunc = [](StringView fileContent) { return new GtkGif(fileContent); }; auto createStaticImageFunc = [](const boost::filesystem::path &filepath) { return new GtkScaledImage(filepath); }; cache = new Cache(createGifFunc, createStaticImageFunc); } return *cache; } }