22#include <zypp/base/Easy.h>
23#include <zypp/base/Flags.h>
24#include <zypp/base/Iterator.h>
25#include <zypp/base/NonCopyable.h>
26#include <zypp-core/base/DefaultIntegral>
28#include <zypp/Pathname.h>
68 , boost::forward_traversal_tag
85 if ( base_reference() && !*(++base_reference()) )
89 {
return( base() ? *base() : 0 ); }
121 Glob( Flags flags_r = Flags() )
131 {
add( pattern_r, flags_r ); }
133 explicit Glob(
const std::string & pattern_r, Flags flags_r = Flags() )
135 {
add( pattern_r, flags_r ); }
137 explicit Glob(
const char * pattern_r, Flags flags_r = Flags() )
139 {
add( pattern_r, flags_r ); }
156 {
return add( pattern_r.
c_str(), flags_r ); }
158 int add(
const std::string & pattern_r, Flags flags_r = Flags() )
159 {
return add( pattern_r.c_str(), flags_r ); }
161 int add(
const char * pattern_r, Flags flags_r = Flags() );
167 void reset( Flags flags_r = Flags() )
215 template<
class TOutputIterator>
217 {
return collect( pattern_r.
c_str(), Flags(), result_r ); }
219 template<
class TOutputIterator>
220 static int collect(
const std::string & pattern_r, TOutputIterator result_r )
221 {
return collect( pattern_r.c_str(), Flags(), result_r ); }
223 template<
class TOutputIterator>
224 static int collect(
const char * pattern_r, TOutputIterator result_r )
225 {
return collect( pattern_r, Flags(), result_r ); }
228 template<
class TOutputIterator>
229 static int collect(
const Pathname & pattern_r, Flags flags_r, TOutputIterator result_r )
230 {
return collect( pattern_r.
c_str(), flags_r, result_r ); }
232 template<
class TOutputIterator>
233 static int collect(
const std::string & pattern_r, Flags flags_r, TOutputIterator result_r )
234 {
return collect( pattern_r.c_str(), flags_r, result_r ); }
236 template<
class TOutputIterator>
237 static int collect(
const char * pattern_r, Flags flags_r, TOutputIterator result_r )
239 Glob glob( pattern_r, flags_r );
242 (*result_r)++ =
typename TOutputIterator::container_type::value_type(*it);
259 {
return str << *obj; }
Integral type with defined initial value when default constructed.
Iterate NULL terminated char* array.
std::ostream & operator<<(std::ostream &str, const Glob::const_iterator &obj)
Stream output.
friend class boost::iterator_core_access
reference dereference() const
const_iterator(char **_idx)
Find pathnames matching a pattern.
static int collect(const std::string &pattern_r, Flags flags_r, TOutputIterator result_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool empty() const
Whether matches were found.
scoped_ptr< ::glob_t > _result
void setDefaultFlags(Flags flags_r=Flags())
Set the default flags passed to ::glob().
int add(const std::string &pattern_r, Flags flags_r=Flags())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Glob(Flags flags_r=Flags())
Default ctor optionally taking the default flags.
size_type size() const
The number of matches found so far.
static int collect(const std::string &pattern_r, TOutputIterator result_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
ZYPP_DECLARE_FLAGS(Flags, Bits)
type Flags: Type-safe OR-combination of Bits.
const_iterator begin() const
Iterator pointing to the first result.
int add(const Pathname &pattern_r, Flags flags_r=Flags())
Add pathnames matching pattern_r to the current result.
static int collect(const char *pattern_r, TOutputIterator result_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Bits
Individual bits to combine in Flags.
@ kOnlyDir
Match only directories.
@ kBrace
Expand "{a,b}" to "a" "b".
@ kPeriod
Leading ‘.’ can be matched by metachars.
@ kNoCheck
If nothing matches, return the pattern.
@ kNoEscape
Backslashes don't quote metacharacters.
@ kNoMagic
If no magic chars, return the pattern.
@ kTilde
Expand ~user and ~ to home directories.
@ kMark
Append a slash to each name.
@ kNoSort
Don't sort the names.
@ kErr
Return on read errors.
@ kAltDirFunc
Use gl_opendir et al functions.
@ kTildeCheck
Like GLOB_TILDE but return an error if the user name is not available.
DefaultIntegral< int, 0 > _lastGlobReturn
int lastGlobReturn() const
Returns the value returned by the last call to ::glob().
static int collect(const Pathname &pattern_r, Flags flags_r, TOutputIterator result_r)
void reset(Flags flags_r=Flags())
Clear all results and reset defaultFlags.
void clear()
Clear all results found so far.
const_iterator end() const
Iterator pointing behind the last result.
static int collect(const char *pattern_r, Flags flags_r, TOutputIterator result_r)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static int collect(const Pathname &pattern_r, TOutputIterator result_r)
Write glob result to some OutputIterator.
Glob(const std::string &pattern_r, Flags flags_r=Flags())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Glob(const Pathname &pattern_r, Flags flags_r=Flags())
Ctor adding pathnames matching pattern_r.
Flags defaultFlags() const
The default flags passed to ::glob().
Glob(const char *pattern_r, Flags flags_r=Flags())
This is an overloaded member function, provided for convenience. It differs from the above function o...
const char * c_str() const
String representation.
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
std::ostream & operator<<(std::ostream &str, const Glob &obj)
Easy-to use interface to the ZYPP dependency resolver.
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)