36 void collectSuggestions(std::u16string_view sPath, std::vector<OUString>& rSuggestionList);
41 mCharacter(aCharacter),
64 mChildren.push_back(std::unique_ptr<TrieNode>(pChild));
70 if (aInputCharacter >=
'a' &&
71 aInputCharacter <=
'z')
78 if ( pCurrent->mCharacter == aInputCharacter )
79 return pCurrent.get();
90 if (pCurrent !=
nullptr)
97 if (pCurrent !=
nullptr)
104 OUString aStringPath = sPath + OUStringChar(pCurrent->
mCharacter);
107 rSuggestionList.push_back(aStringPath);
117 for (
const auto aCurrentChar : sPath )
119 pCurrent = pCurrent->
findChild(aCurrentChar);
120 if ( pCurrent ==
nullptr )
139 if ( sInputString.empty() )
148 for (
const auto aCurrentChar : sInputString )
151 if ( pChild ==
nullptr )
170 if (pNode !=
nullptr)
180 std::vector<OUString> entries;
181 mRoot->collectSuggestions(std::u16string_view(), entries);
182 return entries.size();
void insert(std::u16string_view sInputString) const
void findSuggestions(std::u16string_view sWordPart, std::vector< OUString > &rSuggestionList) const
std::unique_ptr< TrieNode > mRoot
TrieNode * findChild(sal_Unicode aCharacter)
TrieNode(sal_Unicode aCharacter='\0')
static void collectSuggestionsForCurrentNode(TrieNode *pCurrent, std::u16string_view sPath, std::vector< OUString > &rSuggestionList)
static const int LATIN_ARRAY_SIZE
void collectSuggestions(std::u16string_view sPath, std::vector< OUString > &rSuggestionList)
void addNewChild(TrieNode *pChild)
std::vector< std::unique_ptr< TrieNode > > mChildren
std::unique_ptr< TrieNode > mLatinArray[LATIN_ARRAY_SIZE]
TrieNode * traversePath(std::u16string_view sPath)