| 1 | // Scintilla source code edit control |
| 2 | /** @file WordList.h |
| 3 | ** Hold a list of words. |
| 4 | **/ |
| 5 | // Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> |
| 6 | // The License.txt file describes the conditions under which this software may be distributed. |
| 7 | |
| 8 | #ifndef WORDLIST_H |
| 9 | #define WORDLIST_H |
| 10 | |
| 11 | namespace Lexilla { |
| 12 | |
| 13 | /** |
| 14 | */ |
| 15 | class WordList { |
| 16 | // Each word contains at least one character - a empty word acts as sentinel at the end. |
| 17 | char **words; |
| 18 | char *list; |
| 19 | size_t len; |
| 20 | bool onlyLineEnds; ///< Delimited by any white space or only line ends |
| 21 | int starts[256]; |
| 22 | public: |
| 23 | explicit WordList(bool onlyLineEnds_ = false) noexcept; |
| 24 | // Deleted so WordList objects can not be copied. |
| 25 | WordList(const WordList &) = delete; |
| 26 | WordList(WordList &&) = delete; |
| 27 | WordList &operator=(const WordList &) = delete; |
| 28 | WordList &operator=(WordList &&) = delete; |
| 29 | ~WordList(); |
| 30 | operator bool() const noexcept; |
| 31 | bool operator!=(const WordList &other) const noexcept; |
| 32 | int Length() const noexcept; |
| 33 | void Clear() noexcept; |
| 34 | bool Set(const char *s); |
| 35 | bool InList(const char *s) const noexcept; |
| 36 | bool InListAbbreviated(const char *s, const char marker) const noexcept; |
| 37 | bool InListAbridged(const char *s, const char marker) const noexcept; |
| 38 | const char *WordAt(int n) const noexcept; |
| 39 | }; |
| 40 | |
| 41 | } |
| 42 | |
| 43 | #endif |
| 44 | |