summaryrefslogtreecommitdiff
path: root/src/emojis.hpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2024-04-13 22:23:47 -0400
committerGitHub <noreply@github.com>2024-04-13 22:23:47 -0400
commit5e382b11dce3892a3b6d2ea42bc3be0db79c2ef5 (patch)
treecc7ce5c7f335a8eb38742aa5b7eeb978d93fdb78 /src/emojis.hpp
parent964dc3049eda8a0fc8c48299cafc5d46309a962b (diff)
parent8f143ec4fa7914cfaf104ea48ff96a5f0f11bf42 (diff)
downloadabaddon-portaudio-5e382b11dce3892a3b6d2ea42bc3be0db79c2ef5.tar.gz
abaddon-portaudio-5e382b11dce3892a3b6d2ea42bc3be0db79c2ef5.zip
Merge pull request #286 from uowuo/emojis-sqlite
Change emoji resource file to use sqlite instead
Diffstat (limited to 'src/emojis.hpp')
-rw-r--r--src/emojis.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/emojis.hpp b/src/emojis.hpp
index a41b8ac..c0de316 100644
--- a/src/emojis.hpp
+++ b/src/emojis.hpp
@@ -8,11 +8,13 @@
#include <gdkmm/pixbuf.h>
#include <gtkmm/textbuffer.h>
-// shoutout to gtk for only supporting .svg's sometimes
+#include <sqlite3.h>
class EmojiResource {
public:
EmojiResource(std::string filepath);
+ ~EmojiResource();
+
bool Load();
Glib::RefPtr<Gdk::Pixbuf> GetPixBuf(const Glib::ustring &pattern);
const std::map<std::string, std::string> &GetShortCodes() const;
@@ -21,9 +23,10 @@ public:
private:
std::unordered_map<std::string, std::vector<std::string>> m_pattern_shortcode_index;
- std::map<std::string, std::string> m_shortcode_index; // shortcode -> pattern
- std::unordered_map<std::string, std::pair<int, int>> m_index; // pattern -> [pos, len]
- FILE *m_fp = nullptr;
+ std::map<std::string, std::string> m_shortcode_index; // shortcode -> pattern
std::string m_filepath;
std::vector<Glib::ustring> m_patterns;
+
+ sqlite3 *m_db = nullptr;
+ sqlite3_stmt *m_get_emoji_stmt = nullptr;
};