12 #ifndef ZYPP_BASE_STRMATCHER_H 13 #define ZYPP_BASE_STRMATCHER_H 18 #include <zypp/base/PtrTypes.h> 19 #include <zypp/base/Exception.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; }
331 StrMatcher(
const std::string & search_r,
int flags_r );
333 StrMatcher( std::string && search_r,
int flags_r );
347 {
return doMatch( string_r.c_str() ); }
350 {
return doMatch( string_r ); }
388 bool doMatch(
const char * string_r )
const;
403 {
return !( lhs == rhs ); }
410 #endif // ZYPP_BASE_STRMATCHER_H void setFlags(const Match &flags_r)
Set new search flags.
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.
bool isCompiled() const
Whether the StrMatcher is already compiled.
bool isMode(Mode rhs) const
Whether this has mode rhs.
String related utilities and Regular expression matching.
std::string asString() const
String representation.
bool doMatch(const char *string_r) const
Return whether string matches.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
bool isModeStringend() const
Whether this has mode STRINGEND.
void setModeGlob()
Set the mode GLOB.
Exceptions thrown from attribute matching.
Match flags() const
Return the flags part.
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
Mode mode() const
Return the mode part.
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 compile() const
Compile the pattern e.g.
void setSearchstring(const std::string &string_r)
Set a new searchstring.
bool operator()(const Tp &string_r) const
Return whether string matches.
bool operator!=(const StrMatcher &lhs, const StrMatcher &rhs)
void setModeStringstart()
Set the mode STRINGSTART.
void setModeRegex()
Set the mode REGEX.
bool testAnyOf(const Match &rhs) const
Whether at least one of the rhs bits is set (or the same mode).
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)
friend std::ostream & operator<<(std::ostream &str, const StrMatcher &obj)
Mode
Mode flags (mutual exclusive).
Invalid regular expression (failed ::regcomp).
int modeval() const
Return the modes integer representation.
Match & operator-=(const Match &rhs)
Remove flags.
bool isModeStringstart() const
Whether this has mode STRINGSTART.
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.
Match operator-(Match::Mode lhs, Match::Mode rhs)
int get() const
Return the integer representation.
bool isModeGlob() const
Whether this has mode GLOB.
bool operator()(const char *string_r) const
static const Match ARRAYSENTINEL
LookupAttr: internal.
int flagval() const
Return the flags integer representation.
const Match & flags() const
The current search flags.
static const int _flagmask
bool isModeRegex() const
Whether this has mode REGEX.
static const Match COMPLETE_FILELIST
LookupAttr: internal.
static const Match SUB
LookupAttr: internal.
MatchInvalidRegexException(const std::string &msg_r)
Supplied message.
bool test(const Match &rhs) const
Test whether all of the rhs bits are set (same mode if rhs has one).
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.
bool isModeString() const
Whether this has mode STRING.
static const int _modemask
const std::string & searchstring() const
The current searchstring.
bool isModeSubstring() const
Whether this has mode SUBSTRING.