zipios
2.2.6
Zipios -- a small C++ library that provides easy access to .zip files.
|
Go to the documentation of this file.
100 : m_filename(filename)
287 return StorageMethod::STORED;
488 static_cast<void>(size);
500 static_cast<void>(crc);
558 throw InvalidStateException(
"level must be between COMPRESSION_LEVEL_DEFAULT and COMPRESSION_LEVEL_MAXIMUM");
564 throw InvalidStateException(
"directories cannot be marked with a compression level other than COMPRESSION_LEVEL_NONE (defaults will also work");
595 case StorageMethod::STORED:
603 case StorageMethod::DEFLATED:
697 sout <<
" (directory)";
711 << compressed_size <<
" byte"
712 << (compressed_size == 1 ?
"" :
"s")
734 static_cast<void>(is);
735 throw IOException(
"FileEntry::read(): read not available with this type of FileEntry.");
752 static_cast<void>(os);
753 throw IOException(
"FileEntry::write(): write not available with this type of FileEntry.");
int CompressionLevel
The compression level to be used to save an entry.
virtual std::string getFileName() const
Return the basename of this entry.
virtual std::string getName() const
Return the filename of the entry.
virtual void setUnixTime(std::time_t time)
Sets the time field in Unix time format for the entry.
virtual StorageMethod getMethod() const
Return the method used to create this entry.
virtual void setExtra(buffer_t const &extra)
Set the extra field buffer.
CompressionLevel m_compression_level
size_t m_uncompressed_size
A FileEntry represents an entry in a FileCollection.
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
void setEntryOffset(std::streampos offset)
Defines the position of the entry in a Zip archive.
virtual void write(std::ostream &os)
Write this FileEntry to the output stream.
static CompressionLevel const COMPRESSION_LEVEL_MAXIMUM
virtual void setSize(size_t size)
Sets the size field for the entry.
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
virtual std::time_t getUnixTime() const
Get the Unix date/time of this entry.
FileEntry(FilePath const &filename, std::string const &comment=std::string())
Initialize a FileEntry object.
Various functions used throughout the library.
virtual void setMethod(StorageMethod method)
Sets the storage method field for the entry.
virtual void setLevel(CompressionLevel level)
Define the level of compression to use by this FileEntry.
virtual size_t getHeaderSize() const
Retrieve the size of the header.
virtual bool isDirectory() const
Check whether the filename represents a directory.
Exception used when it is not possible to move forward.
bool hasCrc() const
Check whether the CRC32 was defined.
virtual ~FileEntry()
Clean up a FileEntry object.
Handle a file path and name and its statistics.
virtual crc32_t getCrc() const
Return the CRC of the entry.
An IOException is used to signal an I/O error.
std::ostringstream OutputStringStream
An output stream using strings.
virtual void setTime(DOSDateTime::dosdatetime_t time)
Set the FileEntry time using a DOS time.
std::string filename() const
Retrieve the basename.
std::ostream & operator<<(std::ostream &os, FileCollection const &collection)
Write a FileCollection to the output stream.
virtual bool isEqual(FileEntry const &file_entry) const
Compare two file entries for equality.
static CompressionLevel const COMPRESSION_LEVEL_NONE
virtual void setCrc(crc32_t crc)
Save the CRC of the entry.
StorageMethod m_compress_method
std::vector< unsigned char > buffer_t
std::streampos getEntryOffset() const
Get the offset of this entry in a Zip archive.
virtual void setComment(std::string const &comment)
Set the comment field for the FileEntry.
virtual std::string toString() const
Returns a human-readable string representation of the entry.
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
virtual buffer_t getExtra() const
Some extra data to be stored along the entry.
virtual CompressionLevel getLevel() const
Retrieve the compression level.
virtual void setCompressedSize(size_t size)
Set the size when the file is compressed.
virtual bool isValid() const
Check whether this entry is valid.
virtual std::string getComment() const
Retrieve the comment of the file entry.
bool isDirectory() const
Check whether the file is a directory.
virtual DOSDateTime::dosdatetime_t getTime() const
Get the MS-DOS date/time of this entry.
static CompressionLevel const COMPRESSION_LEVEL_MINIMUM
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
Define the zipios::FileEntry class.
virtual void read(std::istream &is)
Read this FileEntry from the input stream.
virtual size_t getSize() const
Retrieve the size of the file when uncompressed.
std::streampos m_entry_offset
The zipios namespace includes the Zipios library definitions.
virtual size_t getCompressedSize() const
Retrieve the size of the file when compressed.