OpenXLSX 1.9.1
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_view data);
97
103 void addEntryFromFile(std::string_view name, std::string_view filePath);
104
109 void deleteEntry(std::string_view entryName);
110
116 [[nodiscard]] std::string getEntry(std::string_view name) const;
117
123 void* openEntryStream(std::string_view name) const;
124
132 int64_t readEntryStream(void* stream, char* buffer, uint64_t size) const;
133
138 void closeEntryStream(void* stream) const;
139
145 [[nodiscard]] bool hasEntry(std::string_view entryName) const;
146
151 [[nodiscard]] std::vector<std::string> entryNames() const;
152
157 void setCompressionLevel(int level);
158
162 int compressionLevel() const;
163
164 private:
165 struct LibZipApp;
166 std::shared_ptr<LibZipApp> m_archive;
167 int m_compressionLevel{1};
168 };
169} // namespace OpenXLSX
170
171#ifdef _MSC_VER // conditionally enable MSVC specific pragmas to avoid other compilers warning about unknown pragmas
172# pragma warning(pop)
173#endif // _MSC_VER
174
175#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:30