12 #ifndef ZYPP_BASE_STRMATCHER_H
13 #define ZYPP_BASE_STRMATCHER_H
96 explicit operator bool()
const
128 { onoff ?
set( rhs ) :
unset( rhs ); }
132 {
set( rhs );
return *
this; }
136 {
unset( rhs );
return *
this; }
150 int get()
const {
return _val; }
218 {
return lhs.
get() == rhs.
get(); }
221 {
return lhs.
get() != rhs.
get(); }
225 {
return Match(lhs) |= rhs; }
228 {
return Match(lhs) |= rhs; }
232 {
return Match(lhs) -= rhs; }
235 {
return Match(lhs) -= rhs; }
325 StrMatcher(
const std::string & search_r,
int flags_r );
328 explicit operator bool()
const
339 {
return doMatch( string_r.c_str() ); }
342 {
return doMatch( string_r ); }
376 bool doMatch(
const char * string_r )
const;
391 {
return !( lhs == rhs ); }
398 #endif // ZYPP_BASE_STRMATCHER_H
bool testAnyOf(const Match &rhs) const
Whether at least one of the rhs bits is set (or the same mode).
bool operator()(const _Tp &string_r) const
Return whether string matches.
void setFlags(const Match &flags_r)
Set new search flags.
bool isMode(Mode rhs) const
Whether this has mode rhs.
Match()
Default ctor 0 or NOTHING.
Match & operator|=(const Match &rhs)
Add flags.
String matching option flags as used e.g.
StrMatcher()
Default ctor matches nothing.
void setModeStringend()
Set the mode STRINGEND.
static const Match SKIP_KIND
LookupAttr: skip any kind: prefix when looking at a Solvable name.
Match operator-(const Match &lhs, const Match &rhs)
String matching (STRING|SUBSTRING|GLOB|REGEX).
bool operator==(const Match &lhs, const Match &rhs)
static const Match CHECKSUMS
LookupAttr: also look for matches in checksums.
Match flags() const
Return the flags part.
String related utilities and Regular expression matching.
void setModeGlob()
Set the mode GLOB.
int modeval() const
Return the modes integer representation.
bool operator()(const char *string_r) const
Exceptions thrown from attribute matching.
bool isModeStringend() const
Whether this has mode STRINGEND.
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
void setModeSubstring()
Set the mode SUBSTRING.
Match(int val_r)
Just in case one needs it.
void unset(const Match &rhs)
Unset all of the rhs bits (unsets mode if the same as rhs).
MatchException(const std::string &msg_r)
Supplied message.
void turn(const Match &rhs, bool onoff)
Depending on the value of onoff, set or unset flags.
void setSearchstring(const std::string &string_r)
Set a new searchstring.
bool operator!=(const StrMatcher &lhs, const StrMatcher &rhs)
bool isModeGlob() const
Whether this has mode GLOB.
std::ostream & operator<<(std::ostream &str, const Exception &obj)
void setModeStringstart()
Set the mode STRINGSTART.
void setModeRegex()
Set the mode REGEX.
void setMode(Mode rhs)
Set the mode part to rhs .
static const Match NO_STORAGE_SOLVABLE
LookupAttr: internal.
StrMatcher implementation.
Match operator|(const Match &lhs, const Match &rhs)
bool isModeStringstart() const
Whether this has mode STRINGSTART.
friend std::ostream & operator<<(std::ostream &str, const StrMatcher &obj)
bool doMatch(const char *string_r) const
Return whether string matches.
std::string asString() const
String representation.
Mode
Mode flags (mutual exclusive).
Invalid regular expression (failed ::regcomp).
const Match & flags() const
The current search flags.
bool isCompiled() const
Whether the StrMatcher is already compiled.
Match & operator-=(const Match &rhs)
Remove flags.
const std::string & searchstring() const
The current searchstring.
int flagval() const
Return the flags integer representation.
bool isModeSubstring() const
Whether this has mode SUBSTRING.
MatchUnknownModeException(const std::string &msg_r)
Supplied message.
Match operator|(Match::Mode lhs, Match::Mode rhs)
static const Match DISABLED_REPOS
LookupAttr: internal.
void setModeString()
Set the mode STRING.
static const Match NOCASE
If set, match case insensitive.
bool operator!=(const Match &lhs, const Match &rhs)
Base class for Exception.
bool isModeRegex() const
Whether this has mode REGEX.
Match operator-(Match::Mode lhs, Match::Mode rhs)
int get() const
Return the integer representation.
static const Match ARRAYSENTINEL
LookupAttr: internal.
Mode mode() const
Return the mode part.
static const int _flagmask
static const Match COMPLETE_FILELIST
LookupAttr: internal.
static const Match SUB
LookupAttr: internal.
MatchInvalidRegexException(const std::string &msg_r)
Supplied message.
Match(Mode val_r)
Ctor from Mode value.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
Easy-to use interface to the ZYPP dependency resolver.
static const Match FILES
LookupAttr: match full path when matching in filelists, otherwise just the basenames.
void compile() const
Compile the pattern e.g.
static const int _modemask
void set(const Match &rhs)
Set all of the rhs bits (setting a new mode if rhs has one).
bool isModeString() const
Whether this has mode STRING.
bool test(const Match &rhs) const
Test whether all of the rhs bits are set (same mode if rhs has one).