34 class DirectoryIteratorImp ;
85 return m_imp->error() ;
90 return m_imp->more() ;
95 return m_imp->filePath() ;
100 return m_imp->fileName() ;
105 return m_imp->isDir() ;
110 return m_imp->modificationTimeString() ;
115 return m_imp->sizeString() ;
130 const int abort = 1 ;
141 m_glob.gl_pathc = 0 ;
142 m_glob.gl_pathv = NULL ;
144 Path wild_path( dir.
path() , wildcard.empty() ? std::string(
"*") : wildcard ) ;
146 int flags = 0 | GLOB_ERR ;
148 if( error || m_glob.gl_pathv == NULL )
166 if( m_index >= static_cast<size_t>(m_glob.gl_pathc) )
175 m_index < static_cast<size_t>(m_glob.gl_pathc) &&
176 m_glob.gl_pathv != NULL &&
177 m_glob.gl_pathv[m_index] != NULL ;
178 const char * file_path = sane ? m_glob.gl_pathv[m_index] :
"" ;
179 return Path( file_path ) ;
184 return Path( filePath().basename() ) ;
196 ::globfree( &m_glob ) ;
201 return std::string() ;
207 return s.empty() ? std::string(
"0") : s ;
std::string sizeString() const
Returns the file size as a decimal string.
std::string modificationTimeString() const
std::string sizeString() const
Path filePath() const
Returns the path of the current item.
DirectoryIterator(const Directory &dir, const std::string &wc)
Constructor taking a directory reference and a wildcard specification.
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.
~DirectoryIterator()
Destructor.
An encapsulation of a file system directory which allows for iterating through the set of contained f...
Path fileName() const
Returns the name of the current item.
int gdirectory_unix_on_error_(const char *, int)
DirectoryIteratorImp(const Directory &dir, const std::string &wildcard)
bool more()
Returns true if more and advances by one.
bool isDir() const
Returns true if the current item is a directory.
std::string modificationTimeString() const
Returns the last-modified time for the file in an undefined format – used for comparison.
static std::string sizeString(const Path &file)
Returns the file's size in string format.
A pimple-pattern implementation class for DirectoryIterator.
bool error() const
Returns true on error. The caller should stop the iteration.
A Path object represents a file system path.