5#include "flutter/fml/ascii_trie.h"
7#include "flutter/fml/logging.h"
19 *trie = std::make_unique<TrieNode>();
21 Add(&(*trie)->children[ch], entry + 1);
25TrieNodePtr MakeTrie(
const std::vector<std::string>& entries) {
27 for (
const std::string& entry : entries) {
28 Add(&
result, entry.c_str());
35 node_ = MakeTrie(entries);
40 const char* char_position = query;
44 while ((ch = *char_position) && (child = trie_position->
children[ch].get())) {
46 trie_position = child;
48 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]