206 return std::make_shared<ZipCentralDirectoryEntry>(*
this);
241 if(g_signature != signature)
243 is.setstate(std::ios::failbit);
244 throw IOException(
"ZipCentralDirectoryEntry::read(): Expected Central Directory entry signature not found");
247 uint16_t writer_version(0);
248 uint16_t compress_method(0);
249 uint32_t dosdatetime(0);
250 uint32_t compressed_size(0);
251 uint32_t uncompressed_size(0);
252 uint32_t rel_offset_loc_head(0);
253 uint16_t filename_len(0);
254 uint16_t extra_field_len(0);
255 uint16_t file_comment_len(0);
256 uint16_t intern_file_attr(0);
257 uint32_t extern_file_attr(0);
258 uint16_t disk_num_start(0);
259 std::string filename;
269 zipRead(is, uncompressed_size);
276 zipRead(is, rel_offset_loc_head);
277 zipRead(is, filename, filename_len);
336 throw InvalidStateException(
"ZipCentralDirectoryEntry::write(): file name, comment, or extra field too large to save in a Zip file.");
340#if INTPTR_MAX != INT32_MAX
346 throw InvalidStateException(
"ZipCentralDirectoryEntry::write(): The size of this file is too large to fit in a zip archive.");
353#if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
356 writer_version |= g_windows;
357#elif defined(__APPLE__) && defined(__MACH__)
359 writer_version |= g_osx;
362 writer_version |= g_unix;
385 uint16_t filename_len(filename.length());
387 uint16_t file_comment_len(
m_comment.length());
388 uint16_t disk_num_start(0);
389 uint16_t intern_file_attr(0);
409 uint32_t extern_file_attr(
m_is_directory ? 0x41FD0010 : 0x81B40000);
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
std::streampos m_entry_offset
static CompressionLevel const COMPRESSION_LEVEL_NONE
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.
virtual ~ZipCentralDirectoryEntry() override
Clean up the entry.
virtual size_t getHeaderSize() const override
Compute and return the current header size.
virtual void write(std::ostream &os) override
Write a Central Directory Entry to the output stream.
ZipCentralDirectoryEntry()
Initializes a default ZipCentralDirectoryEntry object.
virtual pointer_t clone() const override
Create a clone of this Central Directory entry.
virtual void read(std::istream &is) override
Read a Central Directory entry.
An implementation of the FileEntry for Zip archives.
uint16_t m_extract_version
uint16_t m_general_purpose_bitfield
static uint16_t const g_zip_format_version
Define a type to manage date and time in MS-DOS format.
uint16_t const g_alternate_vms
uint16_t const g_atari_st
uint16_t const g_acorn_risc
uint16_t const g_macintosh
uint32_t const g_signature
The signature of a ZipCentralDirectoryEntry.
uint16_t const g_z_system
uint16_t const g_open_vms
uint16_t const g_os2_hpfs
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)
Declaration of the zipios::ZipCentralDirectoryEntry, which represents a directory Zip archive entry.
Various functions used throughout the library.
Various exceptions used throughout the Zipios library, all based on zipios::Exception.