libzypp 17.31.23
PathInfo.cc
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
13#include <zypp/PathInfo.h>
15
16using std::endl;
17using std::string;
18
20namespace zypp
21{
23 namespace filesystem
24 {
25
27 {
28 static StrMatcher noDots( "[^.]*", Match::GLOB );
29 return noDots;
30 }
31
32 int dirForEach( const Pathname & dir_r, const StrMatcher & matcher_r, function<bool( const Pathname &, const char *const)> fnc_r )
33 {
34 if ( ! fnc_r )
35 return 0;
36
37 bool nodots = ( &matcher_r == &matchNoDots() );
38 return dirForEach( dir_r,
39 [&]( const Pathname & dir_r, const char *const name_r )->bool
40 {
41 if ( ( nodots && name_r[0] == '.' ) || ! matcher_r( name_r ) )
42 return true;
43 return fnc_r( dir_r, name_r );
44 } );
45 }
46
48 } // namespace filesystem
51} // namespace zypp
@ GLOB
Glob.
Definition: StrMatcher.h:47
String matching (STRING|SUBSTRING|GLOB|REGEX).
Definition: StrMatcher.h:298
const StrMatcher & matchNoDots()
Convenience returning StrMatcher( "[^.]*", Match::GLOB )
Definition: PathInfo.cc:26
int dirForEach(const Pathname &dir_r, const StrMatcher &matcher_r, function< bool(const Pathname &, const char *const)> fnc_r)
Definition: PathInfo.cc:32
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2