- Linking libexpat required to support loading helix files.
[platform/upstream/libzypp.git] / zypp / Glob.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file       zypp/Glob.cc
10  *
11 */
12 #include <iostream>
13 #include "zypp/base/LogTools.h"
14
15 #include "zypp/Glob.h"
16
17 using std::endl;
18
19 ///////////////////////////////////////////////////////////////////
20 namespace zypp
21 { /////////////////////////////////////////////////////////////////
22   ///////////////////////////////////////////////////////////////////
23   namespace filesystem
24   { /////////////////////////////////////////////////////////////////
25
26     int Glob::add( const std::string & pattern_r, Flags flags_r )
27     {
28       static Flags _APPEND( GLOB_APPEND ); // not published
29       if ( ! flags_r )
30         flags_r = _defaultFlags;
31       if ( _result )
32         flags_r |= _APPEND;
33       else
34         _result.reset( new ::glob_t );
35       return( _lastGlobReturn = ::glob( pattern_r.c_str(), flags_r, NULL, &(*_result) ) );
36     }
37
38     /******************************************************************
39     **
40     **  FUNCTION NAME : operator<<
41     **  FUNCTION TYPE : std::ostream &
42     */
43     std::ostream & operator<<( std::ostream & str, const Glob & obj )
44     {
45       return dumpRange( str << "(" << obj.size() << ")", obj.begin(), obj.end() );
46     }
47
48     /////////////////////////////////////////////////////////////////
49   } // namespace filesystem
50   ///////////////////////////////////////////////////////////////////
51   /////////////////////////////////////////////////////////////////
52 } // namespace zypp
53 ///////////////////////////////////////////////////////////////////