#include <unixstl/filesystem/readdir_sequence.hpp>
This class presents and STL-like readonly sequence interface to allow the iteration over the contents of a directory.
Member Types | |
typedef readdir_sequence | class_type |
This class. | |
typedef size_t | size_type |
The size type. | |
typedef char_type const * | value_type |
The value type. | |
typedef int | flags_type |
The flags type. | |
typedef stlsoft::basic_simple_string < char_type > | string_type |
Public Types | |
Member Constants | |
enum | { includeDots = 0x0008, directories = 0x0010, files = 0x0020, fullPath = 0x0100, absolutePath = 0x0200 } |
Public Member Functions | |
Construction | |
template<typename S> | |
readdir_sequence (S const &directory, flags_type flags=directories|files) | |
Constructs a sequence according to the given criteria. | |
Iteration | |
const_iterator | begin () const |
Begins the iteration. | |
const_iterator | end () const |
Ends the iteration. | |
Attributes | |
bool | empty () const |
Indicates whether the search sequence is empty. | |
string_type const & | get_directory () const |
The search directory. | |
flags_type | get_flags () const |
The flags used by the sequence. | |
Classes | |
class | const_iterator |
Iterator for the readdir_sequence class. More... |
typedef readdir_sequence class_type |
This class.
typedef size_t size_type |
The size type.
typedef char_type const* value_type |
The value type.
typedef int flags_type |
The flags type.
anonymous enum |
readdir_sequence | ( | S const & | directory, | |
flags_type | flags = directories | files | |||
) | [inline] |
Constructs a sequence according to the given criteria.
The constructor initialises a readdir_sequence instance on the given directory with the given flags.
directory | The directory whose contents are to be searched | |
flags | Flags to alter the behaviour of the search |
flags
parameter defaults to directories | files
because this reflects the default behaviour of readdir()
, and also because it is the most efficient.
const_iterator begin | ( | ) | const |
Begins the iteration.
const_iterator end | ( | ) | const |
Ends the iteration.
bool empty | ( | ) | const |
Indicates whether the search sequence is empty.
string_type const& get_directory | ( | ) | const |
The search directory.
flags_type get_flags | ( | ) | const |
The flags used by the sequence.
includeDots
is specified, this function will return includeDots | directories | files