| 75 | size_t TextDict::KeyMaxLength() const { return maxLength; } |
| 76 | |
| 77 | Optional<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 | |
| 89 | LexiconPtr TextDict::GetLexicon() const { return lexicon; } |
| 90 | |