101 : m_filename(filename)
482 static_cast<void>(size);
494 static_cast<void>(crc);
552 throw InvalidStateException(
"level must be between COMPRESSION_LEVEL_DEFAULT and COMPRESSION_LEVEL_MAXIMUM");
558 throw InvalidStateException(
"directories cannot be marked with a compression level other than COMPRESSION_LEVEL_NONE (defaults will also work");
689 sout <<
" (directory)";
697 if(compressed_size != m_uncompressed_size)
703 << compressed_size <<
" byte"
704 << (compressed_size == 1 ?
"" :
"s")
726 static_cast<void>(is);
727 throw IOException(
"FileEntry::read(): read not available with this type of FileEntry.");
744 static_cast<void>(os);
745 throw IOException(
"FileEntry::write(): write not available with this type of FileEntry.");
virtual std::time_t getUnixTime() const
Get the Unix date/time of this entry.
virtual void setTime(dostime_t time)
Set the FileEntry time using a DOS time.
StorageMethod m_compress_method
bool hasCrc() const
Check whether the CRC32 was defined.
std::ostream & operator<<(std::ostream &os, FileCollection const &collection)
Write a FileCollection to the output stream.
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.
std::string filename() const
Retrieve the basename.
virtual void read(std::istream &is)
Read this FileEntry from the input stream.
virtual buffer_t getExtra() const
Some extra data to be stored along the entry.
Various exceptions used throughout the Zipios++ library, all based on zipios::Exception.
virtual StorageMethod getMethod() const
Return the method used to create this entry.
virtual bool isDirectory() const
Check whether the filename represents a directory.
virtual void write(std::ostream &os)
Write this FileEntry to the output stream.
virtual CompressionLevel getLevel() const
Retrieve the compression level.
virtual std::string getFileName() const
Return the basename of this entry.
virtual size_t getSize() const
Retrieve the size of the file when uncompressed.
CompressionLevel m_compression_level
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
virtual crc32_t getCrc() const
Return the CRC of the entry.
dostime_t unix2dostime(time_t unix_time)
Convert a Unix date to a DOS date.
virtual size_t getHeaderSize() const
Retrieve the size of the header.
static CompressionLevel const COMPRESSION_LEVEL_NONE
int CompressionLevel
The compression level to be used to save an entry.
virtual void setComment(std::string const &comment)
Set the comment field for the FileEntry.
virtual void setSize(size_t size)
Sets the size field for the entry.
static CompressionLevel const COMPRESSION_LEVEL_MINIMUM
void setEntryOffset(std::streampos offset)
Defines the position of the entry in a Zip archive.
virtual bool isEqual(FileEntry const &file_entry) const
Compare two file entries for equality.
dostime_t dostime(int year, int month, int day, int hour, int minute, int second)
bool isDirectory() const
Check whether the file is a directory.
virtual dostime_t getTime() const
Get the MS-DOS date/time of this entry.
virtual std::string toString() const
Returns a human-readable string representation of the entry.
An IOException is used to signal an I/O error.
virtual void setMethod(StorageMethod method)
Sets the storage method field for the entry.
virtual void setExtra(buffer_t const &extra)
Set the extra field buffer.
virtual ~FileEntry()
Clean up a FileEntry object.
time_t dos2unixtime(dostime_t dostime)
Convert a DOS time to a Unix time.
A FileEntry represents an entry in a FileCollection.
FileEntry(FilePath const &filename, std::string const &comment=std::string())
Initialize a FileEntry object.
Exception used when it is not possible to move forward.
virtual std::string getComment() const
Retrieve the comment of the file entry.
std::streampos getEntryOffset() const
Get the offset of this entry in a Zip archive.
virtual void setCompressedSize(size_t size)
Set the size when the file is compressed.
virtual size_t getCompressedSize() const
Retrive the size of the file when compressed.
Handle a file path and name and its statistics.
std::vector< unsigned char > buffer_t
Definitions for the MS-DOS to Unix time conversions.
Various functions used throughout the library.
std::ostringstream OutputStringStream
An output stream using strings.
static CompressionLevel const COMPRESSION_LEVEL_MAXIMUM
virtual void setCrc(crc32_t crc)
Save the CRC of the entry.
virtual bool isValid() const
Check whether this entry is valid.
Define the zipios::FileEntry class.
size_t m_uncompressed_size
std::streampos m_entry_offset
virtual void setLevel(CompressionLevel level)
Define the level of compression to use by this FileEntry.