62 size_t central_directory_size(0);
63 for(
auto it = entries.begin(); it != entries.end(); ++it)
66 central_directory_size += (*it)->getHeaderSize();
230 entry->setEntryOffset(os.tellp());
275 size_t const size(pptr() - pbase());
289 throw IOException(
"ZipOutputStreambuf::overflow(): write to buffer failed.");
361 int const curr_pos(os.tellp());
374 os.seekp(entry->getEntryOffset());
void setCount(size_t c)
Set the number of entries.
std::string m_zip_comment
FileEntry::CompressionLevel m_compression_level
virtual ~ZipOutputStreambuf()
Clean up the buffer.
void setEntryClosedState()
Mark the current entry as closed.
void write(std::ostream &os)
Write the ZipEndOfCentralDirectory structure to a stream.
Various exceptions used throughout the Zipios++ library, all based on zipios::Exception.
void finish()
Finish up an output stream buffer.
virtual int overflow(int c=EOF)
Handle an overflow.
void closeStream()
Closing the stream.
virtual int sync()
Synchronize the buffer.
ZipOutputStreambuf(std::streambuf *outbuf)
Initialize a ZipOutputStreambuf object.
virtual size_t getHeaderSize() const override
Retrieve the size of the header.
An implementation of the FileEntry for Zip archives.
void close()
Close the output stream buffer.
void setCentralDirectorySize(size_t size)
Define the size of the central directory.
Define the zipios::ZipOutputStreambuf class.
bool init(FileEntry::CompressionLevel compression_level)
Initialize the zlib library.
static CompressionLevel const COMPRESSION_LEVEL_NONE
void setOffset(offset_t new_offset)
Offset of the Central Directory.
virtual int sync() override
Implement the sync() functionality.
Marker at the end of a Zip archive file.
void putNextEntry(FileEntry::pointer_t entry)
Start saving an entry in the output buffer.
An IOException is used to signal an I/O error.
virtual void write(std::ostream &os) override
Write a ZipLocalEntry to os.
Declare the zipios::ZipLocalEntry class used to handle Zip entries.
std::streambuf * m_outbuf
virtual int overflow(int c=EOF) override
Implementation of the overflow() function.
Declaration of the zipios::ZipEndOfCentralDirectory class.
void setComment(std::string const &comment)
Set the archive comment.
void updateEntryHeaderInfo()
Save the header information.
size_t getSize() const
Retrieve the size of the file deflated.
uint32_t m_overflown_bytes
std::vector< char > m_invec
FileEntry::vector_t m_entries
void closeEntry()
Close this buffer entry.
std::shared_ptr< FileEntry > pointer_t
uint32_t getCrc32() const
Get the CRC32 of the file.
A class to handle stream deflate on the fly.
void writeZipCentralDirectory(std::ostream &os, FileEntry::vector_t &entries, std::string const &comment)
Help function used to write the central directory.
std::vector< pointer_t > vector_t