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

Method MatchPrefixView

src/PrefixMatch.cpp:426–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

424}
425
426PrefixMatchView PrefixMatch::MatchPrefixView(const char* word,
427 size_t len) const {
428 if (singleDict != nullptr) {
429 return singleDict->MatchPrefixValue(word, len);
430 }
431 const Tables::Matcher::Candidate candidate =
432 tables->matcher->MatchPrefixCandidate(word, len);
433 if (candidate.hasValue) {
434 return {true, candidate.keyLength,
435 std::string_view(*candidate.key),
436 std::string_view(*candidate.value)};
437 }
438 return {false, 0, std::string_view(), std::string_view()};
439}
440
441void PrefixMatch::AppendCacheKey(const DictPtr& dict, std::string* output) {
442 const std::list<DictPtr>* dictGroupItems = dict->GetDictGroupItems();

Callers 3

SegmentTextFunction · 0.80
AppendConvertedMethod · 0.80
TEST_FFunction · 0.80

Calls 2

MatchPrefixValueMethod · 0.45
MatchPrefixCandidateMethod · 0.45

Tested by 1

TEST_FFunction · 0.64