11#ifndef OPENXLSX_XLZIPARCHIVE_HPP
12#define OPENXLSX_XLZIPARCHIVE_HPP
16# pragma warning(disable : 4251)
17# pragma warning(disable : 4275)
21#include "OpenXLSX-Exports.hpp"
76 explicit operator bool()
const;
78 [[nodiscard]]
bool isValid()
const;
84 [[nodiscard]]
bool isOpen()
const;
90 void open(std::string_view fileName);
101 void save(std::string_view path =
"");
108 void addEntry(std::string_view name, std::string data);
136 [[nodiscard]] std::string
getEntry(std::string_view name)
const;
150 void* openEntryStream(std::string_view name)
const;
159 int64_t readEntryStream(
void* stream,
char* buffer, uint64_t size)
const;
165 void closeEntryStream(
void* stream)
const;
172 [[nodiscard]]
bool hasEntry(std::string_view entryName)
const;
178 [[nodiscard]] std::vector<std::string> entryNames()
const;
184 void setCompressionLevel(
int level);
189 int compressionLevel()
const;
193 std::shared_ptr<LibZipApp> m_archive;
194 int m_compressionLevel{1};
195 size_t m_maxEntryUncompressedSize{0};
void setMaxEntryUncompressedSize(size_t maxBytes) noexcept
Cap uncompressed size accepted by getEntry (0 = unlimited).
Definition XLZipArchive.hpp:142
void addEntryAllocated(std::string_view name, void *data, size_t size)
Directly adds an allocated buffer to the ZIP archive, transferring ownership to libzip.
Definition XLZipArchive.cpp:242
bool isValid() const
Definition XLZipArchive.cpp:77
void addEntry(std::string_view name, std::string data)
Definition XLZipArchive.cpp:201
size_t maxEntryUncompressedSize() const noexcept
Definition XLZipArchive.hpp:143
XLZipArchive(XLZipArchive &&other) noexcept=default
void deleteEntry(std::string_view entryName)
Definition XLZipArchive.cpp:279
std::string getEntry(std::string_view name) const
Definition XLZipArchive.cpp:292
void addEntryFromFile(std::string_view name, std::string_view filePath)
Add a file to the ZIP archive directly from the file system (useful for streaming large files).
Definition XLZipArchive.cpp:377
void open(std::string_view fileName)
Definition XLZipArchive.cpp:91
bool isOpen() const
Definition XLZipArchive.cpp:79
void save(std::string_view path="")
Definition XLZipArchive.cpp:165
XLZipArchive()
Definition XLZipArchive.cpp:71
void close()
Definition XLZipArchive.cpp:132
XLZipArchive(const XLZipArchive &other)=default
XLZipArchive & operator=(const XLZipArchive &other)=default
XLZipArchive & operator=(XLZipArchive &&other) noexcept=default
Definition IXLCellProvider.hpp:24