70 word(std::move(str), false),
84 word(std::move(str), false),
112 opt = option(opt & 0x0F);
148 type_ = option::LITERAL;
208 type_ = option::REGEX;
A class for handling keywords in dictionaries.
bool assign(const token &tok)
Assign from word or string token.
option
Enumeration for the data type and search/match modes (bitmask).
@ REGEX
Regular expression.
bool isLiteral() const noexcept
The keyType is treated as literal, not as pattern.
bool compile() noexcept
Mark as regular expression.
static bool valid(const char c)
Test for valid keyType character?
void uncompile() noexcept
Mark as literal string.
keyType()
Default construct, empty literal.
bool operator()(const std::string &text) const
Perform smart match on text, as per match().
void swap(keyType &rhs)
Swap contents. Self-swapping is a no-op.
bool isPattern() const noexcept
The keyType is treated as a pattern, not as literal string.
void setType(option opt, bool adjust=false)
Change the representation, optionally stripping invalid word characters when changing to a literal.
void clear()
Clear string and set as literal.
void operator=(const std::string &)=delete
No assignment where type could be indeterminate.
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
static bool stripInvalid(std::string &str)
Strip invalid characters from the given string.
word()=default
Default construct.
static bool valid(char c)
Is this character valid for a word?
static int debug
Debugging.