Use binary search for synonyms, fixes #31

This commit is contained in:
Jeff Doozan
2020-12-19 15:10:05 -05:00
parent b66799f358
commit 88af1a077c
2 changed files with 61 additions and 16 deletions

View File

@@ -102,11 +102,18 @@ public:
class SynFile
{
public:
SynFile()
: syndatabuf(nullptr)
{
}
~SynFile() { g_free(syndatabuf); }
bool load(const std::string &url, gulong wc);
bool lookup(const char *str, glong &idx);
const gchar *get_key(glong idx) { return synlist[idx]; }
private:
std::map<std::string, gulong> synonyms;
gchar *syndatabuf;
std::vector<gchar *> synlist;
};
class Dict : public DictBase