00001 #ifndef CLASSLIB_DIR_ITERATOR_H
00002 # define CLASSLIB_DIR_ITERATOR_H
00003
00004
00005
00006 # include "classlib/sysapi/system.h"
00007 # include <iterator>
00008 # include <string>
00009
00010 namespace lat {
00011
00012
00013
00014
00015
00016 struct DirIteratorData;
00017 class DirIteratorError;
00018 class Filename;
00019
00020
00021
00022
00023
00064 class DirIterator ITERATOR_BASE(input_iterator, std::string, STDC::ptrdiff_t)
00065 {
00066 public:
00067 typedef std::input_iterator_tag iterator_category;
00068 typedef std::string value_type;
00069 typedef STDC::ptrdiff_t difference_type;
00070 typedef void reference;
00071 typedef void pointer;
00072
00073 DirIterator (void);
00074 DirIterator (const char *dirname, bool dots = false);
00075 DirIterator (const std::string &dirname, bool dots = false);
00076 DirIterator (const Filename &dirname, bool dots = false);
00077 DirIterator (const DirIterator &x);
00078 ~DirIterator (void);
00079 DirIterator& operator= (const DirIterator &x);
00080
00081 bool operator== (const DirIterator &x) const;
00082 bool operator!= (const DirIterator &x) const;
00083
00084 std::string operator* (void) const;
00085 DirIterator & operator++ (void);
00086 DirIterator operator++ (int);
00087
00088 void close (bool throwable);
00089
00090 private:
00091 void initialise (const char *dirname, bool dots);
00092 void release (bool throwable);
00093 void next (void);
00094 void steal (void);
00095
00096 bool sysnext (void);
00097 void sysinitialise (const char *dirname);
00098 void sysclose (bool throwable);
00099 std::string sysderef (void) const;
00100
00101 DirIteratorData *m_data;
00102 };
00103
00104
00105
00106
00107 }
00108 #endif // CLASSLIB_DIR_ITERATOR_H