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

Method Match

src/TextDict.cpp:77–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75size_t TextDict::KeyMaxLength() const { return maxLength; }
76
77Optional<const DictEntry*> TextDict::Match(const char* word, size_t len) const {
78 std::unique_ptr<DictEntry> entry(
79 new NoValueDictEntry(std::string(word, len)));
80 const auto& found = std::lower_bound(lexicon->begin(), lexicon->end(), entry,
81 DictEntry::UPtrLessThan);
82 if ((found != lexicon->end()) && ((*found)->Key() == entry->Key())) {
83 return Optional<const DictEntry*>(found->get());
84 } else {
85 return Optional<const DictEntry*>::Null();
86 }
87}
88
89LexiconPtr TextDict::GetLexicon() const { return lexicon; }
90

Callers 4

TEST_FFunction · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
TestMatchMethod · 0.45

Calls 4

beginMethod · 0.45
endMethod · 0.45
KeyMethod · 0.45
getMethod · 0.45

Tested by 4

TEST_FFunction · 0.36
TEST_FFunction · 0.36
TEST_FFunction · 0.36
TestMatchMethod · 0.36