|
libzypp
9.1.2
|
String matching (STRING|SUBSTRING|GLOB|REGEX). More...
#include <AttrMatcher.h>

Classes | |
| struct | Impl |
| AttrMatcher implementation. More... | |
Public Types | |
| typedef MatchException | Exception |
Public Member Functions | |
| AttrMatcher () | |
| Default ctor matches nothing. | |
| AttrMatcher (const std::string &search_r) | |
| Ctor from string matches in Match::STRING mode per default. | |
| AttrMatcher (const std::string &search_r, const Match &flags_r) | |
| Ctor taking string and Match flags. | |
| AttrMatcher (const std::string &search_r, const Match::Mode &flags_r) | |
| Ctor taking string and Match::Mode. | |
| AttrMatcher (const std::string &search_r, int flags_r) | |
| Low level interface wraps flags into Match. | |
| template<class _Tp > | |
| bool | operator() (const _Tp &string_r) const |
| Return whether string matches. | |
| bool | operator() (const char *string_r) const |
| const std::string & | searchstring () const |
| The current searchstring. | |
| void | setSearchstring (const std::string &string_r) |
| Set a new searchstring. | |
| void | setSearchstring (const std::string &string_r, const Match &flags_r) |
| Set a new searchstring and flags. | |
| const Match & | flags () const |
| The current search flags. | |
| void | setFlags (const Match &flags_r) |
| Set new search flags. | |
| void | compile () const |
| Compile the pattern e.g. | |
| bool | isCompiled () const |
| Whether the AttrMatcher is already compiled. | |
| bool | doMatch (const char *string_r) const |
| Return whether string matches. | |
Private Member Functions | |
| friend | base::SafeBool () const |
| bool | boolTest () const |
Private Attributes | |
| RWCOW_pointer< Impl > | _pimpl |
| Pointer to implementation. | |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const AttrMatcher &obj) |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &str, const AttrMatcher &obj) |
| bool | operator== (const AttrMatcher &lhs, const AttrMatcher &rhs) |
| bool | operator!= (const AttrMatcher &lhs, const AttrMatcher &rhs) |
| bool | operator< (const AttrMatcher &lhs, const AttrMatcher &rhs) |
String matching (STRING|SUBSTRING|GLOB|REGEX).
Used by e.g. PoolQuery and LookupAttr for queries, but it can also be used for matching arbitrary strings.
AttrMatcher matches( "foo" ); for_( it, stringlist.begin(), stringlist().end() ) { if ( matches( *it ) ) cout << *it << " has substring 'foo'" << endl; }
Those flags are always set: REG_EXTENDED | REG_NOSUB | REG_NEWLINE
Definition at line 312 of file AttrMatcher.h.
Definition at line 317 of file AttrMatcher.h.
Default ctor matches nothing.
Definition at line 266 of file AttrMatcher.cc.
| zypp::sat::AttrMatcher::AttrMatcher | ( | const std::string & | search_r | ) |
Ctor from string matches in Match::STRING mode per default.
Definition at line 270 of file AttrMatcher.cc.
| zypp::sat::AttrMatcher::AttrMatcher | ( | const std::string & | search_r, |
| const Match & | flags_r | ||
| ) |
Ctor taking string and Match flags.
Definition at line 274 of file AttrMatcher.cc.
| zypp::sat::AttrMatcher::AttrMatcher | ( | const std::string & | search_r, |
| const Match::Mode & | flags_r | ||
| ) |
Ctor taking string and Match::Mode.
Needed because we want them to be treated as Match, and not as int as the compiler woud do.
Definition at line 278 of file AttrMatcher.cc.
| zypp::sat::AttrMatcher::AttrMatcher | ( | const std::string & | search_r, |
| int | flags_r | ||
| ) |
Low level interface wraps flags into Match.
Definition at line 282 of file AttrMatcher.cc.
| bool zypp::sat::AttrMatcher::operator() | ( | const _Tp & | string_r | ) | const [inline] |
Return whether string matches.
You can use it with any class that impements c_str. (std::string, Pathname, IdString, ...). NULL never matches.
Definition at line 354 of file AttrMatcher.h.
References doMatch().
| bool zypp::sat::AttrMatcher::operator() | ( | const char * | string_r | ) | const [inline] |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 357 of file AttrMatcher.h.
References doMatch().
| const std::string & zypp::sat::AttrMatcher::searchstring | ( | ) | const |
The current searchstring.
Definition at line 295 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::searchstring().
Referenced by zypp::sat::LookupAttr::Impl::begin(), boolTest(), zypp::sat::operator<(), and zypp::sat::operator==().
| void zypp::sat::AttrMatcher::setSearchstring | ( | const std::string & | string_r | ) |
Set a new searchstring.
Definition at line 298 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::setSearchstring().
| void zypp::sat::AttrMatcher::setSearchstring | ( | const std::string & | string_r, |
| const Match & | flags_r | ||
| ) |
Set a new searchstring and flags.
Definition at line 301 of file AttrMatcher.cc.
References _pimpl, zypp::sat::AttrMatcher::Impl::setFlags(), and zypp::sat::AttrMatcher::Impl::setSearchstring().
| const Match & zypp::sat::AttrMatcher::flags | ( | ) | const |
The current search flags.
Definition at line 307 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::flags().
Referenced by zypp::sat::LookupAttr::Impl::begin(), zypp::sat::operator<(), and zypp::sat::operator==().
| void zypp::sat::AttrMatcher::setFlags | ( | const Match & | flags_r | ) |
Set new search flags.
Definition at line 310 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::setFlags().
| void zypp::sat::AttrMatcher::compile | ( | ) | const |
Compile the pattern e.g.
in case of REGEX.
| MatchUnknownModeException | If the Match flag more than one mode bit set. |
| MatchInvalidRegexException | If Match::REGEX is set and searchstring is not a valid regular expression. |
Definition at line 286 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::compile().
Referenced by zypp::sat::LookupAttr::Impl::setAttrMatcher().
| bool zypp::sat::AttrMatcher::isCompiled | ( | ) | const |
Whether the AttrMatcher is already compiled.
Definition at line 289 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::isCompiled().
| bool zypp::sat::AttrMatcher::doMatch | ( | const char * | string_r | ) | const |
Return whether string matches.
Compiles the AttrMatcher if this was not yet done.
| MatchException | Any of the exceptions thrown by AttrMatcher::compile. |
Definition at line 292 of file AttrMatcher.cc.
References _pimpl, and zypp::sat::AttrMatcher::Impl::doMatch().
Referenced by operator()().
| zypp::sat::AttrMatcher::base::SafeBool | ( | ) | const [private] |
| bool zypp::sat::AttrMatcher::boolTest | ( | ) | const [inline, private] |
Definition at line 396 of file AttrMatcher.h.
References searchstring().
| std::ostream& operator<< | ( | std::ostream & | str, |
| const AttrMatcher & | obj | ||
| ) | [friend] |
Definition at line 318 of file AttrMatcher.cc.
| std::ostream & operator<< | ( | std::ostream & | str, |
| const AttrMatcher & | obj | ||
| ) | [related] |
Stream output
Definition at line 318 of file AttrMatcher.cc.
| bool operator== | ( | const AttrMatcher & | lhs, |
| const AttrMatcher & | rhs | ||
| ) | [related] |
Definition at line 323 of file AttrMatcher.cc.
| bool operator!= | ( | const AttrMatcher & | lhs, |
| const AttrMatcher & | rhs | ||
| ) | [related] |
Definition at line 412 of file AttrMatcher.h.
| bool operator< | ( | const AttrMatcher & | lhs, |
| const AttrMatcher & | rhs | ||
| ) | [related] |
Arbitrary order for std::container.
Definition at line 329 of file AttrMatcher.cc.
RWCOW_pointer<Impl> zypp::sat::AttrMatcher::_pimpl [private] |
Pointer to implementation.
Definition at line 401 of file AttrMatcher.h.
Referenced by compile(), doMatch(), flags(), isCompiled(), zypp::sat::operator<<(), searchstring(), setFlags(), and setSearchstring().
1.7.6.1