Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4680 | right-hear | 1 | |
2 | #define __filescanner_h__ |
||
3 | |||
4 | |||
5 | #include |
||
6 | #include |
||
7 | #define DIRSEP "\\" |
||
8 | #endif |
||
9 | |||
10 | |||
11 | |||
12 | |||
13 | #include "config.h" |
||
14 | #endif |
||
15 | #ifdef HAVE_DIRENT_H |
||
16 | #define _GCC_BUILD_ |
||
17 | #include |
||
18 | #define DIRSEP "/" |
||
19 | #endif //HAVE_DIRENT_H |
||
20 | |||
21 | |||
22 | #include "lispassert.h" |
||
23 | |||
24 | |||
25 | { |
||
26 | public: |
||
27 | inline CFileNode() : iIsDir(0),iName(""),iDir("") {}; |
||
28 | inline void Set(int aIsDir,char* aName) |
||
29 | { |
||
30 | iIsDir = aIsDir; |
||
31 | iName = aName; |
||
32 | strcpy(iFullName,iDir); |
||
33 | if (strlen(iDir)) |
||
34 | strcat(iFullName,DIRSEP); |
||
35 | strcat(iFullName,aName); |
||
36 | } |
||
37 | inline int IsDirectory() {return iIsDir;}; |
||
38 | inline char* FullName() {return iFullName;}; |
||
39 | inline void SetRoot(char* aDir) {iDir=aDir;}; |
||
40 | private: |
||
41 | int iIsDir; |
||
42 | char *iName; |
||
43 | char iFullName[500]; |
||
44 | char* iDir; |
||
45 | }; |
||
46 | |||
47 | |||
48 | { |
||
49 | public: |
||
50 | CFileScanner(); |
||
51 | ~CFileScanner(); |
||
52 | CFileNode* First(char* base,char* dir); |
||
53 | CFileNode* Next(); |
||
54 | private: |
||
55 | CFileScanner(const CFileScanner& aFileScanner) |
||
56 | : iCurNode() |
||
57 | #ifdef _GCC_BUILD_ |
||
58 | ,dp(NULL),entry(NULL),statbuf() |
||
59 | #endif |
||
60 | { |
||
61 | // copy constructor not written yet, hence the assert |
||
62 | LISPASSERT(0); |
||
63 | } |
||
64 | CFileScanner& operator=(const CFileScanner& aFileScanner) |
||
65 | { |
||
66 | // copy constructor not written yet, hence the assert |
||
67 | LISPASSERT(0); |
||
68 | return *this; |
||
69 | } |
||
70 | private: |
||
71 | CFileNode iCurNode; |
||
72 | |||
73 | |||
74 | |||
75 | |||
76 | DIR *dp; |
||
77 | struct dirent* entry; |
||
78 | struct stat statbuf; |
||
79 | #endif |
||
80 | |||
81 | |||
82 | long handle; |
||
83 | struct _finddata_t info; |
||
84 | int first; |
||
85 | #endif |
||
86 | }; |
||
87 | |||
88 | |||
89 |