19 *trie = std::make_unique<TrieNode>();
22 Add(&(*trie)->children[ch], entry + 1);
26TrieNodePtr MakeTrie(
const std::vector<std::string>& entries) {
28 for (
const std::string& entry : entries) {
29 Add(&result, entry.c_str());
36 node_ = MakeTrie(entries);
41 const char* char_position = query;
45 while ((ch = *char_position) && (child = trie_position->
children[ch].get())) {
47 trie_position = child;
49 return !child && trie_position != trie;
std::unique_ptr< TrieNode > TrieNodePtr
static const int kMaxAsciiValue
The max Ascii value.
bool Query(const char *argument)
Returns true if argument is prefixed by the contents of the trie.
void Fill(const std::vector< std::string > &entries)
Clear and insert all the entries into the trie.
#define FML_DCHECK(condition)
AsciiTrie::TrieNodePtr TrieNodePtr
AsciiTrie::TrieNode TrieNode
TrieNodePtr children[kMaxAsciiValue]