DCL 3.7.4
Loading...
Searching...
No Matches
Dir.h
Go to the documentation of this file.
1#ifndef __DCL_DIR_H__
2#define __DCL_DIR_H__ 20041127
3
4#ifndef __DCL_CONFIG_H__
5#include <dcl/Config.h>
6#endif
7
8#ifdef __WINNT__
9 #ifndef _WINDOWS_
10 #error "Required windows.h, See dcl/_windows.h"
11 #endif
12 #if 0
13 #include <fileapi.h> // HANDLE WIN32_FIND_DATAW
14 #endif
15#else
16 #include <dirent.h>
17#endif
18
19#ifndef __DCL_OBJECT_H__
20#include <dcl/Object.h>
21#endif
22#ifndef __DCL_STRING_H__
23#include <dcl/String.h>
24#endif
25#ifndef __DCL_EXCEPTION_H__
26#include <dcl/Exception.h>
27#endif
28
29__DCL_BEGIN_NAMESPACE
30
32
40class DCLCAPI Dir : public Object
41{
43public:
44#ifdef __WINNT__
45 typedef HANDLE HandleType;
46#else
47 typedef DIR* HandleType;
48#endif
49
55 class DCLCAPI Entry
56 {
57 private:
58#ifdef __WINNT__
59 WIN32_FIND_DATAW __dirent;
60#else
61 struct dirent __dirent;
62#if defined(_AIX)
63 String __path;
64#elif defined(__sun__)
65 String __path;
66 String __name;
67#endif
68#endif
69 friend class Dir;
70 public:
74 Entry();
75
83
84 String name() const
86
90 bool isDir() const;
91
96 bool isLink() const __DCL_THROWS1(IOException*);
97
101 String toString() const __DCL_THROWS1(IOException*);
102 };
103
108 virtual ~Dir();
109
114 Dir(const String& _path)
116
120 void close()
122
126 void rewind()
128
142 bool read(Entry& _entry) __DCL_THROWS1(IOException*);
143
148 const String& path() const { return __path; }
149
150protected:
151 HandleType __handle;
152 String __path;
153};
154
155__DCL_END_NAMESPACE
156
157#endif // __DCL_DIR_H__
#define DCLCAPI
Definition Config.h:95
#define __DCL_THROWS1(e)
Definition Config.h:152
#define DECLARE_CLASSINFO(class_name)
Definition Object.h:227
String __path
Definition Dir.h:152
HandleType __handle
Definition Dir.h:151
Object()
Definition Object.cpp:183
virtual String toString() const
Definition Object.cpp:187