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 );
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 );
367 const Match & flags()
const;
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 std::string asString(const Patch::Category &obj)
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.
bool isMode(Mode rhs) const
Whether this has mode rhs.
String related utilities and Regular expression matching.
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)
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.
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.
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
StrMatcher implementation.
Match operator|(const Match &lhs, const Match &rhs)
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.
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
bool isModeSubstring() const
Whether this has mode SUBSTRING.