#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); static Glib::ustring PatternToHex(const Glib::ustring &pattern); static Glib::ustring HexToPattern(Glib::ustring hex); const std::vector &GetPatterns() const; void ReplaceEmojis(Glib::RefPtr buf, int size = 24); private: std::unordered_map> m_index; // pattern -> [pos, len] FILE *m_fp = nullptr; std::string m_filepath; std::vector m_patterns; };