Parent: [1a897c] (diff)

Child: [56e1da] (diff)

Download this file

fstreewalk.h    46 lines (38 with data), 1.2 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef _FSTREEWALK_H_INCLUDED_
#define _FSTREEWALK_H_INCLUDED_
/* @(#$Id: fstreewalk.h,v 1.3 2005-04-04 13:18:47 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string>
#ifndef NO_NAMESPACES
using std::string;
#endif
class FsTreeWalkerCB;
class FsTreeWalker {
public:
enum CbFlag {FtwRegular, FtwDirEnter, FtwDirReturn};
enum Status {FtwOk=0, FtwError=1, FtwStop=2,
FtwStatAll = FtwError|FtwStop};
enum Options {FtwOptNone = 0, FtwNoRecurse = 1, FtwFollow = 2};
FsTreeWalker(Options opts = FtwOptNone);
~FsTreeWalker();
Status walk(const std::string &dir, FsTreeWalkerCB& cb);
std::string getReason();
int getErrCnt();
bool addSkippedName(const std::string &pattern); // Add a pattern
// for directory
// entries (file
// or dir) to be
// ignored (ie:
// #* , *~)
void clearSkippedNames(); // Clear all patterns
private:
class Internal;
Internal *data;
};
class FsTreeWalkerCB {
public:
virtual ~FsTreeWalkerCB() {}
virtual FsTreeWalker::Status
processone(const string &, const struct stat *, FsTreeWalker::CbFlag)
= 0;
};
#endif /* _FSTREEWALK_H_INCLUDED_ */