OpenXLSX 1.10.0
Loading...
Searching...
No Matches
XLZipArchive.hpp
Go to the documentation of this file.
1#ifndef OPENXLSX_XLZIPARCHIVE_HPP
2#define OPENXLSX_XLZIPARCHIVE_HPP
3
4#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
5# pragma warning(push)
6# pragma warning(disable : 4251)
7# pragma warning(disable : 4275)
8#endif // _MSC_VER
9
10// ===== OpenXLSX Includes ===== //
11#include "OpenXLSX-Exports.hpp"
12
13#include <memory>
14#include <string>
15
16namespace OpenXLSX
17{
21 class OPENXLSX_EXPORT XLZipArchive
22 {
23 public:
28
33 XLZipArchive(const XLZipArchive& other) = default;
34
39 XLZipArchive(XLZipArchive&& other) noexcept = default;
40
45
51 XLZipArchive& operator=(const XLZipArchive& other) = default;
52
58 XLZipArchive& operator=(XLZipArchive&& other) noexcept = default;
59
64 explicit operator bool() const;
65
66 [[nodiscard]] bool isValid() const;
67
72 [[nodiscard]] bool isOpen() const;
73
78 void open(std::string_view fileName);
79
83 void close();
84
89 void save(std::string_view path = "");
90
96 void addEntry(std::string_view name, std::string data);
97
104 void addEntryAllocated(std::string_view name, void* data, size_t size);
105
111 void addEntryFromFile(std::string_view name, std::string_view filePath);
112
117 void deleteEntry(std::string_view entryName);
118
124 [[nodiscard]] std::string getEntry(std::string_view name) const;
125
131 void* openEntryStream(std::string_view name) const;
132
140 int64_t readEntryStream(void* stream, char* buffer, uint64_t size) const;
141
146 void closeEntryStream(void* stream) const;
147
153 [[nodiscard]] bool hasEntry(std::string_view entryName) const;
154
159 [[nodiscard]] std::vector<std::string> entryNames() const;
160
165 void setCompressionLevel(int level);
166
170 int compressionLevel() const;
171
172 private:
173 struct LibZipApp;
174 std::shared_ptr<LibZipApp> m_archive;
175 int m_compressionLevel{1};
176 };
177} // namespace OpenXLSX
178
179#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
180# pragma warning(pop)
181#endif // _MSC_VER
182
183#endif // OPENXLSX_XLZIPARCHIVE_HPP
Definition XLZipArchive.hpp:22
XLZipArchive(XLZipArchive &&other) noexcept=default
XLZipArchive(const XLZipArchive &other)=default
XLZipArchive & operator=(const XLZipArchive &other)=default
XLZipArchive & operator=(XLZipArchive &&other) noexcept=default
Definition IZipArchive.hpp:18
Definition XLZipArchive.cpp:31