LibrePCB Developers Documentation
Loading...
Searching...
No Matches
ziparchive.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_ZIPARCHIVE_H
21#define LIBREPCB_CORE_ZIPARCHIVE_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 ZipArchive;
39}
40
41/*******************************************************************************
42 * Class ZipArchive
43 ******************************************************************************/
44
50class ZipArchive final {
51public:
52 ZipArchive() = delete;
53 ZipArchive(const ZipArchive& other) = delete;
54 ZipArchive& operator=(const ZipArchive& rhs) = delete;
55
63 ZipArchive(const QByteArray& data);
64
72 ZipArchive(const FilePath& fp);
73
79 std::size_t getEntriesCount() const noexcept;
80
91 QString getFileName(std::size_t index);
92
102 QByteArray readFile(std::size_t index);
103
112 void extractTo(const FilePath& dir);
113
114private:
116};
117
118/*******************************************************************************
119 * End of File
120 ******************************************************************************/
121
122} // namespace librepcb
123
124#endif
This class represents absolute, well-formatted paths to files or directories.
Definition filepath.h:127
Zip file reader.
Definition ziparchive.h:50
QByteArray readFile(std::size_t index)
Read the content of a file.
Definition ziparchive.cpp:82
RustHandle< rs::ZipArchive > mHandle
Definition ziparchive.h:115
QString getFileName(std::size_t index)
Get the file name of an entry.
Definition ziparchive.cpp:72
ZipArchive & operator=(const ZipArchive &rhs)=delete
std::size_t getEntriesCount() const noexcept
Get number of ZIp entries (files & directories)
Definition ziparchive.cpp:68
void extractTo(const FilePath &dir)
Extract whole Zip to a directory (overwriting)
Definition ziparchive.cpp:91
ZipArchive(const ZipArchive &other)=delete
Definition occmodel.cpp:76
Definition uuid.h:186
Scoped pointer for Rust objects.
Definition rusthandle.h:41