Welcome to mirror list, hosted at ThFree Co, Russian Federation.

scantree.hpp « unrar « thirdparty « src - github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7ed9a38336a8398c8bae35ddd1b06f458f220207 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef _RAR_SCANTREE_
#define _RAR_SCANTREE_

enum SCAN_DIRS 
{ 
  SCAN_SKIPDIRS,     // Skip directories, but recurse for files if recursion mode is enabled.
  SCAN_GETDIRS,      // Get subdirectories in recurse mode.
  SCAN_GETDIRSTWICE, // Get the directory name both before and after the list of files it contains.
  SCAN_GETCURDIRS    // Get subdirectories in current directory even in RECURSE_NONE mode.
};

enum SCAN_CODE { SCAN_SUCCESS,SCAN_DONE,SCAN_ERROR,SCAN_NEXT };

#define MAXSCANDEPTH    (NM/2)

class CommandData;

class ScanTree
{
  private:
    bool GetNextMask();
    SCAN_CODE FindProc(FindData *FD);
    void ScanError(bool &Error);

    FindFile *FindStack[MAXSCANDEPTH];
    int Depth;

    int SetAllMaskDepth;

    StringList *FileMasks;
    RECURSE_MODE Recurse;
    bool GetLinks;
    SCAN_DIRS GetDirs;
    int Errors;

    // set when processing paths like c:\ (root directory without wildcards)
    bool ScanEntireDisk;

    wchar CurMask[NM];
    wchar OrigCurMask[NM];
    bool SearchAllInRoot;
    size_t SpecPathLength;

    wchar ErrArcName[NM];

    CommandData *Cmd;
  public:
    ScanTree(StringList *FileMasks,RECURSE_MODE Recurse,bool GetLinks,SCAN_DIRS GetDirs);
    ~ScanTree();
    SCAN_CODE GetNext(FindData *FindData);
    size_t GetSpecPathLength() {return SpecPathLength;};
    int GetErrors() {return Errors;};
    void SetErrArcName(const wchar *Name) {wcsncpyz(ErrArcName,Name,ASIZE(ErrArcName));}
    void SetCommandData(CommandData *Cmd) {ScanTree::Cmd=Cmd;}
};

#endif