|
libzypp
9.1.2
|
Find pathnames matching a pattern. More...
#include <Glob.h>

Classes | |
| class | const_iterator |
Iterate NULL terminated char* array. More... | |
Public Types | |
| enum | Bits { _ERR = GLOB_ERR, _MARK = GLOB_MARK, _NOSORT = GLOB_NOSORT, _NOCHECK = GLOB_NOCHECK, _NOESCAPE = GLOB_NOESCAPE, _PERIOD = GLOB_PERIOD, _ALTDIRFUNC = GLOB_ALTDIRFUNC, _BRACE = GLOB_BRACE, _NOMAGIC = GLOB_NOMAGIC, _TILDE = GLOB_TILDE, _ONLYDIR = GLOB_ONLYDIR, _TILDE_CHECK = GLOB_TILDE_CHECK } |
| Individual bits to combine in Flags. More... | |
| typedef size_t | size_type |
| typedef const char * | value_type |
Public Member Functions | |
| ZYPP_DECLARE_FLAGS (Flags, Bits) | |
| type Flags: Type-safe OR-combination of Bits. | |
| Glob (Flags flags_r=Flags()) | |
| Default ctor optionally taking the default flags. | |
| Glob (const Pathname &pattern_r, Flags flags_r=Flags()) | |
| Ctor adding pathnames matching pattern_r. | |
| Glob (const std::string &pattern_r, Flags flags_r=Flags()) | |
| Glob (const char *pattern_r, Flags flags_r=Flags()) | |
| ~Glob () | |
| Dtor. | |
| int | add (const Pathname &pattern_r, Flags flags_r=Flags()) |
| Add pathnames matching pattern_r to the current result. | |
| int | add (const std::string &pattern_r, Flags flags_r=Flags()) |
| int | add (const char *pattern_r, Flags flags_r=Flags()) |
| void | clear () |
| Clear all results found so far. | |
| void | reset (Flags flags_r=Flags()) |
| Clear all results and reset defaultFlags. | |
| Flags | defaultFlags () const |
The default flags passed to ::glob(). | |
| void | setDefaultFlags (Flags flags_r=Flags()) |
Set the default flags passed to ::glob(). | |
| int | lastGlobReturn () const |
Returns the value returned by the last call to ::glob(). | |
| bool | empty () const |
| Whether matches were found. | |
| size_type | size () const |
| The number of matches found so far. | |
| const_iterator | begin () const |
| Iterator pointing to the first result. | |
| const_iterator | end () const |
| Iterator pointing behind the last result. | |
Static Public Member Functions | |
Collecting Glob results to some _OutputIterator | |
std::list<Pathname> p; Glob::collect( "/bin/a*.dat}", std::back_inserter(p) ); Glob::collect( "/bin/a*{.xml,.xml.gz}", Glob::_BRACE, std::back_inserter(p) ); | |
| template<class _OutputIterator > | |
| static int | collect (const Pathname &pattern_r, _OutputIterator result_r) |
Write glob result to some OutputIterator. | |
| template<class _OutputIterator > | |
| static int | collect (const std::string &pattern_r, _OutputIterator result_r) |
| template<class _OutputIterator > | |
| static int | collect (const char *pattern_r, _OutputIterator result_r) |
| template<class _OutputIterator > | |
| static int | collect (const Pathname &pattern_r, Flags flags_r, _OutputIterator result_r) |
| template<class _OutputIterator > | |
| static int | collect (const std::string &pattern_r, Flags flags_r, _OutputIterator result_r) |
| template<class _OutputIterator > | |
| static int | collect (const char *pattern_r, Flags flags_r, _OutputIterator result_r) |
Private Attributes | |
| Flags | _defaultFlags |
| scoped_ptr< ::glob_t > | _result |
| DefaultIntegral< int, 0 > | _lastGlobReturn |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &str, const Glob &obj) |
Find pathnames matching a pattern.
Glob glob( Glob::_BRACE ); glob.add( "/somewhere/solverTestcase/ *{.xml,.xml.gz}" ); glob.add( "/somewhere/else/a*" ); for_( it, glob.begin(), glob.end() ) ...
std::list<Pathname> plist; Glob::collect( "/somewherre/solverTestcase/ *{.xml,.xml.gz}", Glob::_BRACE, std::back_inserter( plist ) );
| typedef size_t zypp::filesystem::Glob::size_type |
| typedef const char* zypp::filesystem::Glob::value_type |
Individual bits to combine in Flags.
| _ERR |
Return on read errors. |
| _MARK |
Append a slash to each name. |
| _NOSORT |
Don't sort the names. |
| _NOCHECK |
If nothing matches, return the pattern. |
| _NOESCAPE |
Backslashes don't quote metacharacters. |
| _PERIOD |
Leading `.' can be matched by metachars. |
| _ALTDIRFUNC |
Use gl_opendir et al functions. |
| _BRACE |
Expand "{a,b}" to "a" "b". |
| _NOMAGIC |
If no magic chars, return the pattern. |
| _TILDE |
Expand ~user and ~ to home directories. |
| _ONLYDIR |
Match only directories. |
| _TILDE_CHECK |
Like GLOB_TILDE but return an error if the user name is not available. |
| zypp::filesystem::Glob::Glob | ( | Flags | flags_r = Flags() | ) | [inline] |
Default ctor optionally taking the default flags.
The flags passed here are the default for add.
| zypp::filesystem::Glob::Glob | ( | const Pathname & | pattern_r, |
| Flags | flags_r = Flags() |
||
| ) | [inline, explicit] |
Ctor adding pathnames matching pattern_r.
The flags passed here are the default for add.
Definition at line 129 of file Glob.h.
References add().
| zypp::filesystem::Glob::Glob | ( | const std::string & | pattern_r, |
| Flags | flags_r = Flags() |
||
| ) | [inline, explicit] |
| zypp::filesystem::Glob::Glob | ( | const char * | pattern_r, |
| Flags | flags_r = Flags() |
||
| ) | [inline, explicit] |
| zypp::filesystem::Glob::~Glob | ( | ) | [inline] |
| zypp::filesystem::Glob::ZYPP_DECLARE_FLAGS | ( | Flags | , |
| Bits | |||
| ) |
type Flags: Type-safe OR-combination of Bits.
| int zypp::filesystem::Glob::add | ( | const Pathname & | pattern_r, |
| Flags | flags_r = Flags() |
||
| ) | [inline] |
Add pathnames matching pattern_r to the current result.
Any flags passed here override the global default passed to the ctor. GLOB_APPEND is atomatically added to the flags f needed.
This invalidates all iterators.
Definition at line 155 of file Glob.h.
References add(), and zypp::filesystem::Pathname::c_str().
| int zypp::filesystem::Glob::add | ( | const std::string & | pattern_r, |
| Flags | flags_r = Flags() |
||
| ) | [inline] |
| int zypp::filesystem::Glob::add | ( | const char * | pattern_r, |
| Flags | flags_r = Flags() |
||
| ) |
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 26 of file Glob.cc.
References _defaultFlags, _lastGlobReturn, and _result.
| void zypp::filesystem::Glob::clear | ( | ) |
Clear all results found so far.
defaultFlags remain active.
Definition at line 38 of file Glob.cc.
References _lastGlobReturn, and _result.
Referenced by reset().
| void zypp::filesystem::Glob::reset | ( | Flags | flags_r = Flags() | ) | [inline] |
Clear all results and reset defaultFlags.
Definition at line 167 of file Glob.h.
References clear(), and setDefaultFlags().
| Flags zypp::filesystem::Glob::defaultFlags | ( | ) | const [inline] |
The default flags passed to ::glob().
Definition at line 173 of file Glob.h.
References _defaultFlags.
| void zypp::filesystem::Glob::setDefaultFlags | ( | Flags | flags_r = Flags() | ) | [inline] |
Set the default flags passed to ::glob().
Definition at line 177 of file Glob.h.
References _defaultFlags.
Referenced by reset().
| int zypp::filesystem::Glob::lastGlobReturn | ( | ) | const [inline] |
Returns the value returned by the last call to ::glob().
Zero on successful completion. Otherwise GLOB_NOSPACE or GLOB_ABORTED or GLOB_NOMATCH.
Definition at line 184 of file Glob.h.
References _lastGlobReturn.
Referenced by collect().
| bool zypp::filesystem::Glob::empty | ( | ) | const [inline] |
| size_type zypp::filesystem::Glob::size | ( | ) | const [inline] |
The number of matches found so far.
Definition at line 193 of file Glob.h.
References _result.
Referenced by zypp::filesystem::operator<<().
| const_iterator zypp::filesystem::Glob::begin | ( | ) | const [inline] |
Iterator pointing to the first result.
Definition at line 197 of file Glob.h.
References _result.
Referenced by collect(), and zypp::filesystem::operator<<().
| const_iterator zypp::filesystem::Glob::end | ( | ) | const [inline] |
Iterator pointing behind the last result.
Definition at line 201 of file Glob.h.
Referenced by collect(), and zypp::filesystem::operator<<().
| static int zypp::filesystem::Glob::collect | ( | const Pathname & | pattern_r, |
| _OutputIterator | result_r | ||
| ) | [inline, static] |
Write glob result to some OutputIterator.
Definition at line 216 of file Glob.h.
References zypp::filesystem::Pathname::c_str(), and collect().
Referenced by collect().
| static int zypp::filesystem::Glob::collect | ( | const std::string & | pattern_r, |
| _OutputIterator | result_r | ||
| ) | [inline, static] |
| static int zypp::filesystem::Glob::collect | ( | const char * | pattern_r, |
| _OutputIterator | result_r | ||
| ) | [inline, static] |
| static int zypp::filesystem::Glob::collect | ( | const Pathname & | pattern_r, |
| Flags | flags_r, | ||
| _OutputIterator | result_r | ||
| ) | [inline, static] |
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 229 of file Glob.h.
References zypp::filesystem::Pathname::c_str(), and collect().
Referenced by collect().
| static int zypp::filesystem::Glob::collect | ( | const std::string & | pattern_r, |
| Flags | flags_r, | ||
| _OutputIterator | result_r | ||
| ) | [inline, static] |
| static int zypp::filesystem::Glob::collect | ( | const char * | pattern_r, |
| Flags | flags_r, | ||
| _OutputIterator | result_r | ||
| ) | [inline, static] |
| std::ostream & operator<< | ( | std::ostream & | str, |
| const Glob & | obj | ||
| ) | [related] |
Flags zypp::filesystem::Glob::_defaultFlags [private] |
Definition at line 248 of file Glob.h.
Referenced by add(), defaultFlags(), and setDefaultFlags().
scoped_ptr< ::glob_t> zypp::filesystem::Glob::_result [private] |
DefaultIntegral<int,0> zypp::filesystem::Glob::_lastGlobReturn [private] |
Definition at line 250 of file Glob.h.
Referenced by add(), clear(), and lastGlobReturn().
1.7.6.1