diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-01 09:30:04 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-01 09:30:04 -0500 |
commit | 617155fe562652c859a380d85cc5710783d79448 (patch) | |
tree | f5eee89b0fa4b3c9dfe7187ca78916a71b59045e /prefix_search.h | |
parent | b316e309559d7176af6cf0bb7dcd6dbaa83c01cd (diff) | |
download | rawr-ebooks-617155fe562652c859a380d85cc5710783d79448.tar.gz rawr-ebooks-617155fe562652c859a380d85cc5710783d79448.tar.bz2 rawr-ebooks-617155fe562652c859a380d85cc5710783d79448.zip |
Added emoji freevar
Strings of emojis are tokenized separately from anything else, and added to an emoticon freevar, which is mixed in with regular emoticons like :P. This breaks old-style freevars like $name$ and $noun$ so some legacy support for compatibility is left in but eventually $name$ should be made into an actual new freevar. Emoji data is from gemoji (https://github.com/github/gemoji).
Diffstat (limited to 'prefix_search.h')
-rw-r--r-- | prefix_search.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/prefix_search.h b/prefix_search.h new file mode 100644 index 0000000..dd2f535 --- /dev/null +++ b/prefix_search.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef PREFIX_SEARCH_H_5CFCF783 | ||
2 | #define PREFIX_SEARCH_H_5CFCF783 | ||
3 | |||
4 | #include <map> | ||
5 | #include <string> | ||
6 | |||
7 | class prefix_search { | ||
8 | public: | ||
9 | void add(std::string prefix); | ||
10 | int match(std::string in) const; | ||
11 | |||
12 | private: | ||
13 | struct node { | ||
14 | std::map<int, struct node> children; | ||
15 | bool match; | ||
16 | |||
17 | node() : match(false) {} | ||
18 | }; | ||
19 | |||
20 | node top; | ||
21 | }; | ||
22 | |||
23 | #endif /* end of include guard: PREFIX_SEARCH_H_5CFCF783 */ | ||