diff options
Diffstat (limited to 'src/DirHelper.hh')
-rw-r--r-- | src/DirHelper.hh | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/DirHelper.hh b/src/DirHelper.hh index df6b301..c41066b 100644 --- a/src/DirHelper.hh +++ b/src/DirHelper.hh | |||
@@ -1,5 +1,5 @@ | |||
1 | // DirHelper.hh | 1 | // DirHelper.hh |
2 | // Copyright (c) 2002 Henrik Kinnunen (fluxgen at users.sourceforge.net) | 2 | // Copyright (c) 2002-2003 Henrik Kinnunen (fluxgen at users.sourceforge.net) |
3 | // | 3 | // |
4 | // Permission is hereby granted, free of charge, to any person obtaining a | 4 | // Permission is hereby granted, free of charge, to any person obtaining a |
5 | // copy of this software and associated documentation files (the "Software"), | 5 | // copy of this software and associated documentation files (the "Software"), |
@@ -19,29 +19,35 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: DirHelper.hh,v 1.1 2002/12/02 19:44:24 fluxgen Exp $ | 22 | // $Id: DirHelper.hh,v 1.2 2003/02/15 01:41:50 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef DIRHELPER_HH | 24 | #ifndef DIRHELPER_HH |
25 | #define DIRHELPER_HH | 25 | #define DIRHELPER_HH |
26 | 26 | ||
27 | #include "NotCopyable.hh" | ||
28 | |||
27 | #include <sys/types.h> | 29 | #include <sys/types.h> |
28 | #include <dirent.h> | 30 | #include <dirent.h> |
31 | #include <string> | ||
29 | 32 | ||
30 | #include "NotCopyable.hh" | 33 | /// Wrapper class for DIR * routines |
31 | |||
32 | /** | ||
33 | Wrapper class for DIR * routines | ||
34 | */ | ||
35 | class DirHelper: private FbTk::NotCopyable { | 34 | class DirHelper: private FbTk::NotCopyable { |
36 | public: | 35 | public: |
37 | explicit DirHelper(const char *dir = 0); | 36 | explicit DirHelper(const char *dir = 0); |
38 | ~DirHelper(); | 37 | ~DirHelper(); |
38 | |||
39 | void rewind(); | 39 | void rewind(); |
40 | /// gets next dirent info struct in directory | ||
40 | struct dirent * read(); | 41 | struct dirent * read(); |
41 | void close(); | 42 | /// reads next filename in directory |
43 | std::string readFilename(); | ||
44 | void close(); | ||
42 | bool open(const char *dir); | 45 | bool open(const char *dir); |
46 | /// @return number of entries in the directory | ||
47 | size_t entries() const { return m_num_entries; } | ||
43 | private: | 48 | private: |
44 | DIR *m_dir; | 49 | DIR *m_dir; |
50 | size_t m_num_entries; ///< number of file entries in directory | ||
45 | }; | 51 | }; |
46 | 52 | ||
47 | #endif // DIRHELPER_HH | 53 | #endif // DIRHELPER_HH |