readdir_sequence Class Reference
[File System Library]

#include <unixstl/filesystem/readdir_sequence.hpp>

Inheritance diagram for readdir_sequence:

stl_collection_tag collection_tag

List of all members.


Detailed Description

STL-like readonly sequence based on directory contents.

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...


Member Typedef Documentation

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.


Member Enumeration Documentation

anonymous enum

Enumerator:
includeDots  Requests that dots directories be included in the returned sequence.
directories  Causes the search to include directories.
files  Causes the search to include files.
fullPath  Each file entry is presented as a full path relative to the search directory.
absolutePath  The search directory is converted to an absolute path.


Constructor & Destructor Documentation

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.

Parameters:
directory The directory whose contents are to be searched
flags Flags to alter the behaviour of the search
Note:
The flags parameter defaults to directories | files because this reflects the default behaviour of readdir(), and also because it is the most efficient.


Member Function Documentation

const_iterator begin (  )  const

Begins the iteration.

Returns:
An iterator representing the start of the sequence

const_iterator end (  )  const

Ends the iteration.

Returns:
An iterator representing the end of the sequence

bool empty (  )  const

Indicates whether the search sequence is empty.

string_type const& get_directory (  )  const

The search directory.

Note:
The value returned by this method always has a trailing path name separator, so you can safely concatenate this with the value returned by the iterator's operator *() with minimal fuss.

flags_type get_flags (  )  const

The flags used by the sequence.

Note:
This value is the value used by the sequence, which may, as a result of the determination of defaults, be different from those specified in its constructor. In other words, if includeDots is specified, this function will return includeDots | directories | files


The documentation for this class was generated from the following file:

Generated on Thu Jun 10 08:59:08 2010 for STLSoft by  doxygen 1.5.6