#pragma once #include #include #include #include #include // shoutout to gtk for only supporting .svg's sometimes class EmojiResource { public: EmojiResource(std::string filepath); bool Load(); Glib::RefPtr GetPixBuf(const Glib::ustring &pattern); const std::vector &GetPatterns() const; const std::map &GetShortCodes() const; void ReplaceEmojis(Glib::RefPtr buf, int size = 24); std::string GetShortCodeForPattern(const Glib::ustring &pattern); private: std::unordered_map> m_pattern_shortcode_index; std::map m_shortcode_index; // shortcode -> pattern std::unordered_map> m_index; // pattern -> [pos, len] FILE *m_fp = nullptr; std::string m_filepath; std::vector m_patterns; };