Pol  Revision:4b29d2b
dirlist.h
Go to the documentation of this file.
1 
7 #ifndef CLIB_DIRLIST_H
8 #define CLIB_DIRLIST_H
9 
10 #include <string>
11 
12 #include "Header_Windows.h"
13 
14 #ifndef WINDOWS
15 #include <dirent.h>
16 #include <sys/types.h>
17 #endif
18 
19 namespace Pol
20 {
21 namespace Clib
22 {
23 class DirList
24 {
25 public:
26  explicit DirList( const char* path );
27  explicit DirList();
28  ~DirList();
29 
30  void open( const char* filespec );
31 
32  bool at_end() const;
33  std::string name() const;
34  void next();
35 
36 
37 private:
38 #ifdef _WIN32
39  WIN32_FIND_DATA fd_;
40  HANDLE hfd_;
41 #else
42  DIR* dir_;
43  std::string cur_name_;
44 #endif
45 
46 
47 private: // not implemented
48  DirList( const DirList& );
49  DirList& operator=( const DirList& );
50 };
51 
52 std::string curdir();
53 
54 class PushDir
55 {
56 public:
57  PushDir( const char* dir );
58  ~PushDir();
59 
60  bool ok() const;
61 
62 private:
63  bool ok_;
64 #ifdef MAX_PATH
65  char savedir_[MAX_PATH];
66 #else
67  char savedir_[256];
68 #endif
69 };
70 }
71 }
72 #endif
std::string name() const
Definition: dirlist.cpp:107
DirList & operator=(const DirList &)
std::string cur_name_
Definition: dirlist.h:43
bool at_end() const
Definition: dirlist.cpp:102
void open(const char *filespec)
Definition: dirlist.cpp:98
std::string curdir()
Definition: dirlist.cpp:160
Definition: berror.cpp:12