84 if( sorted ) list.
sort() ;
85 list.m_list.swap( out ) ;
90 readType( dir , std::string() ) ;
99 for(
unsigned int i = 0U ; iter.
more() && !iter.
error() ; ++i )
103 if( limit == 0U || m_list.size() < limit )
106 item.m_is_dir = iter.
isDir() ;
109 m_list.push_back( item ) ;
111 if( m_list.size() == limit )
123 more = ! m_list.empty() ;
128 more = m_index < m_list.size() ;
135 return m_list.at(m_index).m_is_dir ;
140 return m_list.at(m_index).m_path ;
145 return m_list.at(m_index).m_name ;
148 bool G::DirectoryList::compare(
const Item & a ,
const Item & b )
150 return a.m_name.compare( b.m_name ) < 0 ;
155 std::sort( m_list.begin() , m_list.end() , std::ptr_fun(compare) ) ;
A directory-entry item for G::DirectoryList.
bool more()
Returns true if more and advances by one.
static bool tailMatch(const std::string &in, const std::string &ending)
Returns true if the given string has the given ending.
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.
Directory()
Default constructor for the current directory.
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 ...
A variant class holding a string, an item map keyed by name, or an ordered list of items...
bool more()
Returns true if more and advances by one.
bool isDir() const
Returns true if the current item is a directory.
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.
DirectoryList()
Default constructor for an empty list.