LibrePCB Developers Documentation
Loading...
Searching...
No Matches
zipwriter.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_ZIPWRITER_H
21#define LIBREPCB_CORE_ZIPWRITER_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../utils/rusthandle.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class FilePath;
36
37namespace rs {
38struct ZipWriter;
39}
40
41/*******************************************************************************
42 * Class ZipWriter
43 ******************************************************************************/
44
50class ZipWriter final {
51public:
52 ZipWriter(const ZipWriter& other) = delete;
53 ZipWriter& operator=(const ZipWriter& rhs) = delete;
54
60 ZipWriter();
61
69 ZipWriter(const FilePath& fp);
70
74 ~ZipWriter() noexcept;
75
83 void writeFile(const QString& path, const QByteArray& data, uint32_t mode);
84
92 void finish();
93
104 const QByteArray& getData() const;
105
106private:
107 QByteArray mBuffer;
110};
111
112/*******************************************************************************
113 * End of File
114 ******************************************************************************/
115
116} // namespace librepcb
117
118#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
Zip file writer.
Definition zipwriter.h:50
ZipWriter()
Create in-memory writer.
Definition zipwriter.cpp:61
ZipWriter(const ZipWriter &other)=delete
ZipWriter & operator=(const ZipWriter &rhs)=delete
void finish()
Finish writing the file.
Definition zipwriter.cpp:83
const QByteArray & getData() const
Get the in-memory ZIP data.
Definition zipwriter.cpp:92
QByteArray mBuffer
Definition zipwriter.h:107
RustHandle< rs::ZipWriter > mHandle
Definition zipwriter.h:108
void writeFile(const QString &path, const QByteArray &data, uint32_t mode)
Write a file.
Definition zipwriter.cpp:74
bool mFinished
Definition zipwriter.h:109
~ZipWriter() noexcept
Destructor.
Definition zipwriter.cpp:68
Definition occmodel.cpp:76
Scoped pointer for Rust objects.
Definition rusthandle.h:41