30 #if defined(_WINDOWS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32)
31 #define ZIPIOS_WINDOWS
97 : m_recursive(recursive)
208 if(!ent || ent->isDirectory())
299 #ifdef ZIPIOS_WINDOWS
312 m_handle = _findfirsti64(path.getName().c_str(), &m_findinfo);
323 throw IOException(
"an I/O error occured while reading a directory");
334 _findclose(m_handle);
342 __int64
const r(_findnexti64(m_handle, &m_fileinfo));
347 throw IOException(
"an I/O error occured while reading a directory");
349 return std::string();
358 return m_fileinfo.name;
363 struct _finddata_t m_fileinfo;
364 bool m_read_first = 0;
370 : m_dir(opendir(static_cast<std::string>(path).c_str()))
374 throw IOException(
"an I/O error occured while trying to access directory");
386 struct dirent *entry, e;
387 int const r(readdir_r(m_dir, &e, &entry));
390 throw IOException(
"an I/O error occured while reading a directory");
394 return std::string();
397 return entry->d_name;
408 std::string
const& name(dir.next());
416 if(name !=
"." && name !=
"..")
virtual FileEntry::pointer_t getEntry(std::string const &name, MatchPath matchpath=MatchPath::MATCH) const
Get an entry from this collection.
std::shared_ptr< FileCollection > pointer_t
virtual FileEntry::vector_t entries() const override
Retrieve a vector to the collection entries.
void loadEntries() const
This is an internal function that loads the file entries.
Various exceptions used throughout the Zipios++ library, all based on zipios::Exception.
bool isRegular() const
Check whether the file is a regular file.
std::shared_ptr< std::istream > stream_pointer_t
A shared pointer to an input stream.
virtual FileEntry::vector_t entries() const
Retrieve the array of entries.
Define the zipios::DirectoryCollection class.
A collection generated from reading a directory.
virtual size_t size() const override
Return the number of entries defined in this collection.
virtual void close() override
Close the directory collection.
virtual pointer_t clone() const override
Create another DirectoryCollection.
DirectoryCollection()
Initialize a DirectoryCollection object.
FileEntry::vector_t m_entries
bool isDirectory() const
Check whether the file is a directory.
An IOException is used to signal an I/O error.
virtual void close()
Close the current FileEntry of this FileCollection.
virtual void mustBeValid() const
Check whether the collection is valid.
void load(FilePath const &subdir)
This is the function loading all the file entries.
Handle a file path and name and its statistics.
virtual ~DirectoryCollection() override
Clean up a DirectoryCollection object.
A file entry that does not use compression.
virtual stream_pointer_t getInputStream(std::string const &entry_name, MatchPath matchpath=MatchPath::MATCH) override
Retrieve pointer to an istream.
virtual FileEntry::pointer_t getEntry(std::string const &name, MatchPath matchpath=MatchPath::MATCH) const override
Get an entry from the collection.
std::shared_ptr< FileEntry > pointer_t
std::vector< pointer_t > vector_t