libzypp
10.5.0
|
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.
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::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.
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() |
||
) |
void zypp::filesystem::Glob::clear | ( | ) |
void zypp::filesystem::Glob::reset | ( | Flags | flags_r = Flags() | ) | [inline] |
Clear all results and reset defaultFlags.
Flags zypp::filesystem::Glob::defaultFlags | ( | ) | const [inline] |
void zypp::filesystem::Glob::setDefaultFlags | ( | Flags | flags_r = Flags() | ) | [inline] |
int zypp::filesystem::Glob::lastGlobReturn | ( | ) | const [inline] |
bool zypp::filesystem::Glob::empty | ( | ) | const [inline] |
size_type zypp::filesystem::Glob::size | ( | ) | const [inline] |
const_iterator zypp::filesystem::Glob::begin | ( | ) | const [inline] |
const_iterator zypp::filesystem::Glob::end | ( | ) | const [inline] |
static int zypp::filesystem::Glob::collect | ( | const Pathname & | pattern_r, |
_OutputIterator | result_r | ||
) | [inline, static] |
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] |
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] |
scoped_ptr< ::glob_t> zypp::filesystem::Glob::_result [private] |
DefaultIntegral<int,0> zypp::filesystem::Glob::_lastGlobReturn [private] |