34 class DirectoryIteratorImp ;
36 class DirectoryIterator ;
60 int usable(
bool for_creating_files =
false )
const ;
71 bool valid(
bool for_creating_files =
false )
const ;
74 bool writeable(
const std::string & probe_filename =
tmp() )
const ;
82 static std::string
tmp() ;
150 bool m_is_dir{
false} ;
159 void readAll(
const Path & dir ) ;
163 void readType(
const Path & dir ,
const std::string & suffix ,
unsigned int limit = 0U ) ;
185 static void readAll(
const Path & dir , std::vector<Item> & out ,
bool sorted ) ;
190 static bool compare(
const Item & ,
const Item & ) ;
194 unsigned int m_index{0U} ;
195 std::vector<Item> m_list ;
A pimple-pattern implementation class for DirectoryIterator using opendir()/readdir().
A iterator that returns filenames in a directory.
DirectoryIterator(const Directory &dir)
Constructor taking a directory reference.
std::string fileName() const
Returns the name of the current item.
bool error() const
Returns true on error. The caller should stop the iteration.
std::string sizeString() const
Returns the file size as a decimal string.
~DirectoryIterator()
Destructor.
bool isDir() const
Returns true if the current item is a directory.
bool more()
Returns true if more and advances by one.
Path filePath() const
Returns the path of the current item.
A iterator similar to G::DirectoryIterator but doing all file i/o in one go.
DirectoryList()
Default constructor for an empty list.
An encapsulation of a file system directory that works with G::DirectoryIterator.
int usable(bool for_creating_files=false) const
Returns zero if the object represents a valid directory with permissions that dont disallow reading o...
bool writeable(const std::string &probe_filename=tmp()) const
Tries to create and then delete an empty test file in the directory.
static std::string tmp()
A convenience function for constructing a filename for writeable().
Path path() const
Returns the directory's path, as passed in to the ctor.
bool valid(bool for_creating_files=false) const
Returns true iff usable() is zero.
Directory()
Default constructor for the current directory.
A Path object represents a file system path.
A directory-entry item for G::DirectoryList.