MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / MatchPrefixValue

Method MatchPrefixValue

src/DartsDict.cpp:204–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202LexiconPtr DartsDict::GetLexicon() const { return lexicon; }
203
204PrefixMatchView DartsDict::MatchPrefixValue(const char* word,
205 size_t len) const {
206 Optional<const DictEntry*> matched = MatchPrefix(word, len);
207 if (matched.IsNull()) {
208 return PrefixMatchView{};
209 }
210 const DictEntry* entry = matched.Get();
211 const size_t keyLen = entry->KeyLength();
212 return PrefixMatchView{true, keyLen, std::string_view(word, keyLen),
213 entry->GetDefaultView()};
214}
215
216DartsDictPtr DartsDict::NewFromFile(FILE* fp) {
217 DartsDictPtr dict(new DartsDict());

Callers 2

MatchPrefixMethod · 0.45
MatchPrefixViewMethod · 0.45

Calls 3

MatchPrefixFunction · 0.85
IsNullMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected