30 #include <sys/types.h>
34 class DirectoryIteratorImp ;
36 class DirectoryIterator ;
57 explicit Directory(
const std::string & path ) ;
63 bool valid(
bool for_creating_files =
false )
const ;
72 bool writeable( std::string probe_filename =
tmp() )
const ;
86 static std::string
tmp() ;
163 void readType(
const Path & dir ,
const std::string & suffix ,
unsigned int limit = 0U ) ;
183 static void readAll(
const Path & dir , std::vector<Item> & out ,
bool sorted ) ;
188 static bool compare(
const Item & ,
const Item & ) ;
192 unsigned int m_index ;
193 std::vector<Item> m_list ;
std::string sizeString() const
Returns the file size as a decimal string.
A directory-entry item for G::DirectoryList.
bool more()
Returns true if more and advances by one.
Path filePath() const
Returns the path of the current item.
Path filePath() const
Returns the current path.
void readAll(const Path &dir)
An initialiser that is to be used after default construction.
void sort()
Sorts the files lexicographically.
Path path() const
Returns the directory's path.
bool valid(bool for_creating_files=false) const
Returns true if the object represents a valid directory.
Directory()
Default constructor for the current directory.
bool writeable(std::string probe_filename=tmp()) const
Tries to create and then delete an empty test file in the directory.
~DirectoryIterator()
Destructor.
void readType(const Path &dir, const std::string &suffix, unsigned int limit=0U)
An initialiser that is to be used after default construction.
An encapsulation of a file system directory that allows for iterating through the set of contained fi...
A Directory iterator with the same kind of interface as G::DirectoryIterator, but doing all file i/o ...
static std::string tmp()
A convenience function for constructing a filename for writeable().
bool more()
Returns true if more and advances by one.
bool isDir() const
Returns true if the current item is a directory.
A pimple-pattern implementation class for DirectoryIterator using opendir()/readdir().
std::string fileName() const
Returns the name of the current item.
bool isDir() const
Returns true if the current item is a directory.
Directory & operator=(const Directory &)
Assignment operator.
bool error() const
Returns true on error. The caller should stop the iteration.
std::string fileName() const
Returns the current filename.
A Path object represents a file system path.
DirectoryIterator(const Directory &dir)
Constructor taking a directory reference.
DirectoryList()
Default constructor for an empty list.