Go to the documentation of this file.
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; }
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; }
241 std::ostream &
operator<<( std::ostream &
str,
const Match & obj );
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
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
MatchUnknownModeException(const std::string &msg_r)
Supplied message.
Match & operator-=(const Match &rhs)
Remove flags.
static const Match SKIP_KIND
LookupAttr: skip any kind: prefix when looking at a Solvable name.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
Match()
Default ctor 0 or NOTHING.
bool operator!=(const Match &lhs, const Match &rhs)
Base class for Exception.
String matching (STRING|SUBSTRING|GLOB|REGEX).
int get() const
Return the integer representation.
static const Match FILES
LookupAttr: match full path when matching in filelists, otherwise just the basenames.
Match(int val_r)
Just in case one needs it.
static const Match ARRAYSENTINEL
LookupAttr: internal.
Invalid regular expression (failed ::regcomp).
Mode
Mode flags (mutual exclusive).
int modeval() const
Return the modes integer representation.
void set(const Match &rhs)
Set all of the rhs bits (setting a new mode if rhs has one).
void setFlags(const Match &flags_r)
Set new search flags.
Mode mode() const
Return the mode part.
void setModeRegex()
Set the mode REGEX.
static const Match NO_STORAGE_SOLVABLE
LookupAttr: internal.
@ REGEX
Regular Expression.
@ SUBSTRING
Match substring.
bool isModeRegex() const
Whether this has mode REGEX.
bool operator==(const SetRelation::Enum &lhs, const SetCompare &rhs)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool doMatch(const char *string_r) const
Return whether string matches.
Match & operator|=(const Match &rhs)
Add flags.
bool isModeStringend() const
Whether this has mode STRINGEND.
bool operator==(const Match &lhs, const Match &rhs)
static const Match DISABLED_REPOS
LookupAttr: internal.
MatchException(const std::string &msg_r)
Supplied message.
Match operator|(Match::Mode lhs, Match::Mode rhs)
@ STRINGEND
Match at string end.
void setModeStringstart()
Set the mode STRINGSTART.
bool operator()(const char *string_r) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isModeGlob() const
Whether this has mode GLOB.
void setModeStringend()
Set the mode STRINGEND.
StrMatcher implementation.
void turn(const Match &rhs, bool onoff)
Depending on the value of onoff, set or unset flags.
bool isModeString() const
Whether this has mode STRING.
std::string asString() const
String representation.
bool isModeSubstring() const
Whether this has mode SUBSTRING.
void setSearchstring(const std::string &string_r)
Set a new searchstring.
static const int _flagmask
Match flags() const
Return the flags part.
StrMatcher()
Default ctor matches nothing.
bool isModeStringstart() const
Whether this has mode STRINGSTART.
void setModeSubstring()
Set the mode SUBSTRING.
Easy-to use interface to the ZYPP dependency resolver.
@ STRINGSTART
Match at string start.
friend std::ostream & operator<<(std::ostream &str, const StrMatcher &obj)
const std::string & searchstring() const
The current searchstring.
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 COMPLETE_FILELIST
LookupAttr: internal.
Match operator-(Match::Mode lhs, Match::Mode rhs)
void setModeGlob()
Set the mode GLOB.
bool isCompiled() const
Whether the StrMatcher is already compiled.
bool operator!=(const StrMatcher &lhs, const StrMatcher &rhs)
static const int _modemask
int flagval() const
Return the flags integer representation.
Match operator-(const Match &lhs, const Match &rhs)
std::ostream & operator<<(std::ostream &str, const Exception &obj)
Match operator|(const Match &lhs, const Match &rhs)
void compile() const
Compile the pattern e.g.
MatchInvalidRegexException(const std::string &msg_r)
Supplied message.
Match(Mode val_r)
Ctor from Mode value.
void setModeString()
Set the mode STRING.
static const Match NOCASE
If set, match case insensitive.
String related utilities and Regular expression matching.
Exceptions thrown from attribute matching.
static const Match SUB
LookupAttr: internal.
bool test(const Match &rhs) const
Test whether all of the rhs bits are set (same mode if rhs has one).
void unset(const Match &rhs)
Unset all of the rhs bits (unsets mode if the same as rhs).
bool operator()(const Tp &string_r) const
Return whether string matches.
String matching option flags as used e.g. by StrMatcher.
static const Match CHECKSUMS
LookupAttr: also look for matches in checksums.
const Match & flags() const
The current search flags.
bool isMode(Mode rhs) const
Whether this has mode rhs.