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);
255 std::ostream &
operator<<( std::ostream & str,
const Glob & obj );
259 {
return str << *obj; }
271 #endif // ZYPP_GLOB_H
Leading `.' can be matched by metachars.
const_iterator(char **_idx)
static int collect(const Pathname &pattern_r, TOutputIterator result_r)
Write glob result to some OutputIterator.
static int collect(const std::string &pattern_r, TOutputIterator result_r)
scoped_ptr< ::glob_t > _result
Iterate NULL terminated char* array.
static int collect(const std::string &pattern_r, Flags flags_r, TOutputIterator result_r)
std::ostream & operator<<(std::ostream &str, const Glob::const_iterator &obj)
static int collect(const char *pattern_r, TOutputIterator result_r)
Backslashes don't quote metacharacters.
Like GLOB_TILDE but return an error if the user name is not available.
Glob(const char *pattern_r, Flags flags_r=Flags())
int lastGlobReturn() const
Returns the value returned by the last call to ::glob().
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
DefaultIntegral< int, 0 > _lastGlobReturn
If no magic chars, return the pattern.
Expand "{a,b}" to "a" "b".
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 std::string &pattern_r, Flags flags_r=Flags())
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
If nothing matches, return the pattern.
const char * c_str() const
String representation.
void reset(Flags flags_r=Flags())
Clear all results and reset defaultFlags.
Expand ~user and ~ to home directories.
Find pathnames matching a pattern.
bool empty() const
Whether matches were found.
const_iterator begin() const
Iterator pointing to the first result.
Glob(Flags flags_r=Flags())
Default ctor optionally taking the default flags.
int add(const Pathname &pattern_r, Flags flags_r=Flags())
Add pathnames matching pattern_r to the current result.
const_iterator end() const
Iterator pointing behind the last result.
reference dereference() const
Bits
Individual bits to combine in Flags.
friend class boost::iterator_core_access
ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Glob::Flags)
Use gl_opendir et al functions.
ZYPP_DECLARE_FLAGS(Flags, Bits)
type Flags: Type-safe OR-combination of Bits.
void setDefaultFlags(Flags flags_r=Flags())
Set the default flags passed to ::glob().
Append a slash to each name.
size_type size() const
The number of matches found so far.
std::ostream & operator<<(std::ostream &str, const Glob &obj)
void clear()
Clear all results found so far.
static int collect(const char *pattern_r, Flags flags_r, TOutputIterator result_r)
int add(const std::string &pattern_r, Flags flags_r=Flags())
static int collect(const Pathname &pattern_r, Flags flags_r, TOutputIterator result_r)