12 #ifndef ZYPP_BASE_STRMATCHER_H 13 #define ZYPP_BASE_STRMATCHER_H 87 : _val( modeval( val_r ) )
96 explicit operator bool()
const 112 _val = rhs._val | flagval();
120 if ( modeval() == rhs.
modeval() )
121 _val = flagval() & ~rhs.
flagval();
128 { onoff ?
set( rhs ) : unset( rhs ); }
132 {
set( rhs );
return *
this; }
136 { unset( rhs );
return *
this; }
144 {
return Match( flagval() ); }
150 int get()
const {
return _val; }
152 int modeval()
const {
return _val & _modemask; }
154 int flagval()
const {
return _val & _flagmask; }
162 {
return modeval() == modeval( rhs ); }
165 {
return isMode( STRING ); }
168 {
return isMode( STRINGSTART ); }
171 {
return isMode( STRINGEND ); }
174 {
return isMode( SUBSTRING ); }
177 {
return isMode( GLOB ); }
180 {
return isMode( REGEX ); }
184 { _val = modeval( rhs ) | flagval(); }
187 { setMode( STRING ); }
190 { setMode( STRINGSTART ); }
193 { setMode( STRINGEND ); }
196 { setMode( SUBSTRING ); }
202 { setMode( REGEX ); }
210 static int modeval( Mode mode_r );
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 ); }
406 bool operator<(
const StrMatcher & lhs,
const StrMatcher & rhs );
410 #endif // ZYPP_BASE_STRMATCHER_H void setFlags(const Match &flags_r)
Set new search flags.
bool operator==(const Capability &lhs, const Capability &rhs)
relates: Capability
Match()
Default ctor 0 or NOTHING.
Match operator-(const Match &lhs, const Match &rhs)
relates: Match
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.
std::string asString(const Patch::Category &obj)
relates: Patch::Category string representation.
String matching (STRING|SUBSTRING|GLOB|REGEX).
Match operator|(const Match &lhs, const Match &rhs)
relates: Match
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.
bool doMatch(const char *string_r) const
Return whether string matches.
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.
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.
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.
const Arch Arch_empty ZYPP_API
relates: Arch This is an empty Arch represented by an empty string.
StrMatcher implementation.
bool operator!=(const Capability &lhs, const Capability &rhs)
relates: Capability
friend std::ostream & operator<<(std::ostream &str, const StrMatcher &obj)
relates: StrMatcher Stream output
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.
static const Match DISABLED_REPOS
LookupAttr: internal.
void setModeString()
Set the mode STRING.
static const Match NOCASE
If set, match case insensitive.
Base class for Exception.
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.
bool operator<(const Capability &lhs, const Capability &rhs)
relates: Capability Arbitrary order.
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).
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Match(Mode val_r)
Ctor from Mode value.
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.