Glob.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00012 #include <iostream>
00013 #include "zypp/base/LogTools.h"
00014
00015 #include "zypp/Glob.h"
00016
00017 using std::endl;
00018
00020 namespace zypp
00021 {
00022
00023 namespace filesystem
00024 {
00025
00026 int Glob::add( const char * pattern_r, Flags flags_r )
00027 {
00028 static Flags _APPEND( GLOB_APPEND );
00029 if ( ! flags_r )
00030 flags_r = _defaultFlags;
00031 if ( _result )
00032 flags_r |= _APPEND;
00033 else
00034 _result.reset( new ::glob_t );
00035 return( _lastGlobReturn = ::glob( pattern_r, flags_r, NULL, &(*_result) ) );
00036 }
00037
00038 void Glob::clear()
00039 {
00040 if ( _result )
00041 {
00042 ::globfree( &(*_result) );
00043 _result.reset();
00044 _lastGlobReturn = 0;
00045 }
00046 }
00047
00048
00049
00050
00051
00052
00053 std::ostream & operator<<( std::ostream & str, const Glob & obj )
00054 {
00055 return dumpRange( str << "(" << obj.size() << ")", obj.begin(), obj.end() );
00056 }
00057
00059 }
00062 }