Switch to unified view

a/src/utils/fstreewalk.h b/src/utils/fstreewalk.h
1
#ifndef _FSTREEWALK_H_INCLUDED_
1
#ifndef _FSTREEWALK_H_INCLUDED_
2
#define _FSTREEWALK_H_INCLUDED_
2
#define _FSTREEWALK_H_INCLUDED_
3
/* @(#$Id: fstreewalk.h,v 1.1 2004-12-10 18:13:13 dockes Exp $  (C) 2004 J.F.Dockes */
3
/* @(#$Id: fstreewalk.h,v 1.2 2005-02-10 15:21:12 dockes Exp $  (C) 2004 J.F.Dockes */
4
4
5
#include <string>
5
#include <string>
6
6
7
#ifndef NO_NAMESPACES
8
using std::string;
9
#endif
10
11
class FsTreeWalkerCB;
7
12
8
class FsTreeWalker {
13
class FsTreeWalker {
9
 public:
14
 public:
10
    enum CbFlag {FtwRegular, FtwDirEnter, FtwDirReturn};
15
    enum CbFlag {FtwRegular, FtwDirEnter, FtwDirReturn};
11
    enum Status {FtwOk=0, FtwError=1, FtwStop=2, 
16
    enum Status {FtwOk=0, FtwError=1, FtwStop=2, 
12
         FtwStatAll = FtwError|FtwStop};
17
         FtwStatAll = FtwError|FtwStop};
13
    enum Options {FtwOptNone = 0, FtwNoRecurse = 1, FtwFollow = 2};
18
    enum Options {FtwOptNone = 0, FtwNoRecurse = 1, FtwFollow = 2};
14
19
15
    typedef Status (*CbType)(void *cdata, 
16
               const std::string &, const struct stat *, CbFlag);
17
18
    FsTreeWalker(Options opts = FtwOptNone);
20
    FsTreeWalker(Options opts = FtwOptNone);
19
    ~FsTreeWalker();
21
    ~FsTreeWalker();
20
    Status walk(const std::string &dir, CbType fun, void *cdata);
22
    Status walk(const std::string &dir, FsTreeWalkerCB& cb);
21
    std::string getReason();
23
    std::string getReason();
22
    int getErrCnt();
24
    int getErrCnt();
23
 private:
25
 private:
24
    class Internal;
26
    class Internal;
25
    Internal *data;
27
    Internal *data;
26
};
28
};
27
29
30
class FsTreeWalkerCB {
31
 public:
32
    virtual ~FsTreeWalkerCB() {}
33
    virtual FsTreeWalker::Status 
34
  processone(const string &, const struct stat *, FsTreeWalker::CbFlag) 
35
  = 0;
36
};
28
#endif /* _FSTREEWALK_H_INCLUDED_ */
37
#endif /* _FSTREEWALK_H_INCLUDED_ */