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; }
331 StrMatcher(
const std::string & search_r,
int flags_r );
333 StrMatcher( std::string && search_r,
int flags_r );
337 {
return !searchstring().empty(); }
347 {
return doMatch( string_r.c_str() ); }
350 {
return doMatch( string_r ); }
354 const std::string & searchstring()
const;
357 void setSearchstring(
const std::string & string_r );
359 void setSearchstring( std::string && string_r );
362 void setSearchstring(
const std::string & string_r,
const Match & flags_r );
364 void setSearchstring( std::string && string_r,
const Match & flags_r );
370 void setFlags(
const Match & flags_r );
379 void compile()
const;
382 bool isCompiled()
const;
388 bool doMatch(
const char * string_r )
const;
403 {
return !( lhs == rhs ); }
410 #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 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.
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.
std::ostream & operator<<(std::ostream &str, const Match &obj)
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.
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).
bool operator()(const Tp &string_r) const
Return whether string matches.
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.
bool operator!=(const StrMatcher &lhs, const StrMatcher &rhs)
bool isModeGlob() const
Whether this has mode GLOB.
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.
std::string asString() const
String representation.
Mode
Mode flags (mutual exclusive).
Invalid regular expression (failed ::regcomp).
Match & operator-=(const Match &rhs)
Remove flags.
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.
static const int _modemask
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).