86 : m_zip_comment(zip_comment)
232 ssize_t
const HEADER_SIZE(static_cast<ssize_t>(
sizeof(uint32_t) * 3 +
sizeof(uint16_t) * 5));
240 if(static_cast<ssize_t>(buf.size() - pos) < HEADER_SIZE)
254 uint16_t disk_number;
255 uint16_t central_directory_entries;
256 uint16_t central_directory_total_entries;
257 uint32_t central_directory_size;
258 uint32_t central_directory_offset;
259 uint16_t comment_len;
261 zipRead(buf, pos, disk_number);
262 zipRead(buf, pos, disk_number);
263 zipRead(buf, pos, central_directory_entries);
264 zipRead(buf, pos, central_directory_total_entries);
265 zipRead(buf, pos, central_directory_size);
266 zipRead(buf, pos, central_directory_offset);
267 zipRead(buf, pos, comment_len);
272 if(central_directory_entries != central_directory_total_entries)
274 throw FileCollectionException(
"ZipEndOfCentralDirectory with a number of entries and total entries that differ is not supported, spanned zip files are not supported");
330 uint16_t
const disk_number(0);
342 zipWrite(os, central_directory_entries);
343 zipWrite(os, central_directory_entries);
344 zipWrite(os, central_directory_size);
345 zipWrite(os, central_directory_offset);
void setCount(size_t c)
Set the number of entries.
void write(std::ostream &os)
Write the ZipEndOfCentralDirectory structure to a stream.
size_t getCount() const
Retrieve the number of entries.
Various exceptions used throughout the Zipios++ library, all based on zipios::Exception.
void zipRead(std::istream &is, uint32_t &value)
offset_t getOffset() const
Retrieve the offset of the Central Directory.
void setCentralDirectorySize(size_t size)
Define the size of the central directory.
void setOffset(offset_t new_offset)
Offset of the Central Directory.
offset_t m_central_directory_offset
void zipWrite(std::ostream &os, uint32_t const &value)
size_t m_central_directory_entries
std::string m_zip_comment
std::vector< unsigned char > buffer_t
A buffer of characters.
uint32_t const g_signature
Signature of the ZipEndOfCentralDirectory structure block.
Exception used when it is not possible to move forward.
FileCollectionException is used to signal a FileCollection problem.
Declaration of the zipios::ZipEndOfCentralDirectory class.
ZipEndOfCentralDirectory(std::string const &zip_comment="")
Initialize an ZipEndOfCentralDirectory object.
size_t m_central_directory_size
size_t getCentralDirectorySize() const
Retrieve the size of the Central Directory in bytes.
bool read(::zipios::buffer_t const &buf, size_t pos)
Attempt to read an ZipEndOfCentralDirectory structure.