84 { std::ostringstream
str;
str << *
this;
return str.str(); }
90#define OUTS(V) case Match::V: return str << #V; break
101 return str <<
"Match::Mode::UNKNOWN";
107 return str <<
"NOTHING";
109 const char *
sep =
"|";
117 str << mode<<
"("<<
obj.modeval()<<
")";
124 int val =
obj.flagval();
127#define OUTS(V) if ( val & Match::V.get() ) { val &= ~Match::V.get(); if ( sep ) str << sep; else sep = "|"; str << #V; }
129 OUTS( NO_STORAGE_SOLVABLE );
131 OUTS( ARRAYSENTINEL );
132 OUTS( DISABLED_REPOS );
133 OUTS( COMPLETE_FILELIST );
153 :
str::form(
_(
"Unknown match mode '%s' for pattern '%s'"),
mode_r.asString().c_str(),
msg_r.c_str() ) )
158 :
str::form(
_(
"Invalid regular expression '%s'"),
regex_r.c_str() ) )
239 ::datamatcher_free(
_matcher.get() );
258 return str <<
"\"" <<
obj.searchstring() <<
"\"{" <<
obj.flags() <<
"}";
298 {
return _pimpl->compile(); }
301 {
return _pimpl->isCompiled(); }
307 {
return _pimpl->searchstring(); }
326 {
return _pimpl->flags(); }
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
shared_ptr< Impl > _pimpl
String matching option flags as used e.g.
static const Match DISABLED_REPOS
LookupAttr: internal.
int get() const
Return the integer representation.
std::string asString() const
String representation.
static const Match ARRAYSENTINEL
LookupAttr: internal.
static const Match SUB
LookupAttr: internal.
Mode
Mode flags (mutual exclusive).
@ STRINGEND
Match at string end.
@ REGEX
Regular Expression.
@ STRINGSTART
Match at string start.
@ SUBSTRING
Match substring.
static const Match COMPLETE_FILELIST
LookupAttr: internal.
static const Match CHECKSUMS
LookupAttr: also look for matches in checksums.
static const int _flagmask
static const Match NO_STORAGE_SOLVABLE
LookupAttr: internal.
static const Match FILES
LookupAttr: match full path when matching in filelists, otherwise just the basenames.
static const Match SKIP_KIND
LookupAttr: skip any kind: prefix when looking at a Solvable name.
static const Match NOCASE
If set, match case insensitive.
int modeval() const
Return the modes integer representation.
static const int _modemask
Mode mode() const
Return the mode part.
String matching (STRING|SUBSTRING|GLOB|REGEX).
bool doMatch(const char *string_r) const
Return whether string matches.
const std::string & searchstring() const
The current searchstring.
const Match & flags() const
The current search flags.
RWCOW_pointer< Impl > _pimpl
Pointer to implementation.
StrMatcher()
Default ctor matches nothing.
void setSearchstring(const std::string &string_r)
Set a new searchstring.
void setFlags(const Match &flags_r)
Set new search flags.
bool isCompiled() const
Whether the StrMatcher is already compiled.
void compile() const
Compile the pattern e.g.
String related utilities and Regular expression matching.
std::string hexstring(char n, int w=4)
Easy-to use interface to the ZYPP dependency resolver.
bool operator<(const StrMatcher &lhs, const StrMatcher &rhs)
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...
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Exceptions thrown from attribute matching.
Invalid regular expression (failed ::regcomp).
MatchInvalidRegexException(const std::string &msg_r)
Supplied message.
MatchUnknownModeException(const std::string &msg_r)
Supplied message.
StrMatcher implementation.
Impl * clone() const
clone for RWCOW_pointer
const Match & flags() const
The current search flags.
Impl & operator=(Impl &&)=delete
const std::string & searchstring() const
The current searchstring.
void compile() const
Compile the pattern.
bool isCompiled() const
Whether the pattern is already compiled.
bool doMatch(const char *string_r) const
Return whether string matches.
void invalidate()
Has to be called if _search or _flags change.
void setSearchstring(std::string string_r)
Set a new searchstring.
std::ostream & operator<<(std::ostream &str, const StrMatcher::Impl &obj)
Stream output.
Impl & operator=(const Impl &)=delete
Impl(std::string search_r, const Match &flags_r)
void setFlags(const Match &flags_r)
Set new search flags.
Impl(const Impl &)=delete
scoped_ptr< sat::detail::CDatamatcher > _matcher
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.