VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
G::Directory Class Reference

An encapsulation of a file system directory that allows for iterating through the set of contained files. More...

#include <gdirectory.h>

Public Member Functions

 Directory ()
 Default constructor for the current directory.
 
 Directory (const char *path)
 Constructor.
 
 Directory (const Path &path)
 Constructor.
 
 Directory (const std::string &path)
 Constructor.
 
 ~Directory ()
 Destructor.
 
bool valid (bool for_creating_files=false) const
 Returns true if the object represents a valid directory. More...
 
bool writeable (std::string probe_filename=tmp()) const
 Tries to create and then delete an empty test file in the directory. More...
 
Path path () const
 Returns the directory's path.
 
 Directory (const Directory &other)
 Copy constructor.
 
Directoryoperator= (const Directory &)
 Assignment operator.
 

Static Public Member Functions

static std::string tmp ()
 A convenience function for constructing a filename for writeable(). More...
 

Detailed Description

An encapsulation of a file system directory that allows for iterating through the set of contained files.

See Also
G::Path, G::FileSystem, G::File

Definition at line 45 of file gdirectory.h.

Member Function Documentation

std::string G::Directory::tmp ( )
static

A convenience function for constructing a filename for writeable().

This is factored-out to this public interface so that client code can minimise the time spent with a privileged effective userid.

Definition at line 99 of file gdirectory_unix.cpp.

bool G::Directory::valid ( bool  for_creating_files = false) const

Returns true if the object represents a valid directory.

Does additional checks if the 'for-creating-files' parameter is true. But note that the answer is not definitive – file creation may fail, even if valid() returns true. For a more accurate test use writeable().

Definition at line 69 of file gdirectory_unix.cpp.

bool G::Directory::writeable ( std::string  probe_filename = tmp()) const

Tries to create and then delete an empty test file in the directory.

Returns true on success. Precondition: valid()

Definition at line 106 of file gdirectory_unix.cpp.


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