59uint32_t
const g_signature = 0x04034b50;
139 , m_is_directory(src.isDirectory())
157 return std::make_shared<ZipLocalEntry>(*
this);
337 uint32_t signature(0);
339 if(g_signature != signature)
342 is.setstate(std::ios::failbit);
343 throw IOException(
"ZipLocalEntry::read() expected a signature but got some other data");
346 uint16_t compress_method(0);
347 uint32_t dosdatetime(0);
348 uint32_t compressed_size(0);
349 uint32_t uncompressed_size(0);
350 uint16_t filename_len(0);
351 uint16_t extra_field_len(0);
352 std::string filename;
361 zipRead(is, uncompressed_size);
364 zipRead(is, filename, filename_len);
403 throw InvalidStateException(
"ZipLocalEntry::write(): file name or extra field too large to save in a Zip file.");
408#if INTPTR_MAX != INT32_MAX
438 std::uint16_t filename_len(filename.length());
dosdatetime_t getDOSDateTime() const
Retrieve the DOSDateTime value as is.
std::time_t getUnixTimestamp() const
Retrieve the DOSDateTime as a Unix timestamp.
void setDOSDateTime(dosdatetime_t datetime)
Set the DOSDateTime value as is.
void setUnixTimestamp(std::time_t unix_timestamp)
Set the DOSDateTime value from a Unix timestamp.
A FileEntry represents an entry in a FileCollection.
std::size_t m_uncompressed_size
std::shared_ptr< FileEntry > pointer_t
StorageMethod m_compress_method
CompressionLevel m_compression_level
static CompressionLevel const COMPRESSION_LEVEL_NONE
virtual bool isEqual(FileEntry const &file_entry) const
Compare two file entries for equality.
Handle a file path and name and its statistics.
size_t length() const
Get the length of the string.
An IOException is used to signal an I/O error.
Exception used when it is not possible to move forward.
An implementation of the FileEntry for Zip archives.
uint16_t m_extract_version
virtual pointer_t clone() const override
Create a clone of a ZipLocalEntry object.
virtual void setCrc(crc32_t crc) override
Save the CRC of the entry.
virtual void setCompressedSize(size_t size) override
Set the size when the file is compressed.
virtual ~ZipLocalEntry() override
Clean up a ZipLocalEntry object.
virtual void read(std::istream &is) override
Read one local entry from is.
virtual bool isDirectory() const override
Check whether the filename represents a directory.
uint16_t m_general_purpose_bitfield
virtual void write(std::ostream &os) override
Write a ZipLocalEntry to os.
ZipLocalEntry()
Create a default ZipLocalEntry objects.
virtual bool isEqual(FileEntry const &file_entry) const override
Compare two file entries for equality.
virtual size_t getHeaderSize() const override
Retrieve the size of the header.
bool hasTrailingDataDescriptor() const
Is there a trailing data descriptor?
virtual size_t getCompressedSize() const override
Retrieve the size of the file when compressed.
Define a type to manage date and time in MS-DOS format.
uint16_t const g_trailing_data_descriptor
A bit in the general purpose flags.
The zipios namespace includes the Zipios library definitions.
void zipRead(std::istream &is, uint32_t &value)
StorageMethod
The types used with FileEntry::setMethod and FileEntry::getMethod.
char const g_separator
The character used as the filename separator.
void zipWrite(std::ostream &os, uint32_t const &value)
Various functions used throughout the library.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
Declare the zipios::ZipLocalEntry class used to handle Zip entries.