JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_ZipFile.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 The code included in this file is provided under the terms of the ISC license
11 http://www.isc.org/downloads/software-support-policy/isc-license. Permission
12 To use, copy, modify, and/or distribute this software for any purpose with or
13 without fee is hereby granted provided that the above copyright notice and
14 this permission notice appear in all copies.
15
16 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
17 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
18 DISCLAIMED.
19
20 ==============================================================================
21*/
22
23namespace juce
24{
25
26//==============================================================================
35class JUCE_API ZipFile
36{
37public:
39 explicit ZipFile (const File& file);
40
41 //==============================================================================
48 ZipFile (InputStream* inputStream, bool deleteStreamWhenDestroyed);
49
54 explicit ZipFile (InputStream& inputStream);
55
61 explicit ZipFile (InputSource* inputSource);
62
64 ~ZipFile();
65
66 //==============================================================================
92
93 //==============================================================================
95 int getNumEntries() const noexcept;
96
101 const ZipEntry* getEntry (int index) const noexcept;
102
109 int getIndexOfFileName (const String& fileName, bool ignoreCase = false) const noexcept;
110
118 const ZipEntry* getEntry (const String& fileName, bool ignoreCase = false) const noexcept;
119
121 void sortEntriesByFilename();
122
123 //==============================================================================
137 InputStream* createStreamForEntry (int index);
138
152 InputStream* createStreamForEntry (const ZipEntry& entry);
153
154 //==============================================================================
164 Result uncompressTo (const File& targetDirectory,
165 bool shouldOverwriteFiles = true);
166
178 Result uncompressEntry (int index,
179 const File& targetDirectory,
180 bool shouldOverwriteFiles = true);
181
182 enum class OverwriteFiles { no, yes };
183 enum class FollowSymlinks { no, yes };
184
197 Result uncompressEntry (int index,
198 const File& targetDirectory,
199 OverwriteFiles overwriteFiles,
200 FollowSymlinks followSymlinks);
201
202 //==============================================================================
208 class JUCE_API Builder
209 {
210 public:
212 Builder();
213
215 ~Builder();
216
225 void addFile (const File& fileToAdd, int compressionLevel,
226 const String& storedPathName = String());
227
240 void addEntry (InputStream* streamToRead, int compressionLevel,
241 const String& storedPathName, Time fileModificationTime);
242
247 bool writeToStream (OutputStream& target, double* progress) const;
248
249 //==============================================================================
250 private:
251 struct Item;
252 OwnedArray<Item> items;
253
255 };
256
257private:
258 //==============================================================================
259 struct ZipInputStream;
260 struct ZipEntryHolder;
261
263 CriticalSection lock;
264 InputStream* inputStream = nullptr;
265 std::unique_ptr<InputStream> streamToDelete;
267
268 #if JUCE_DEBUG
269 struct OpenStreamCounter
270 {
271 OpenStreamCounter() = default;
272 ~OpenStreamCounter();
273
274 int numOpenStreams = 0;
275 };
276
277 OpenStreamCounter streamCounter;
278 #endif
279
280 void init();
281
283};
284
285} // namespace juce
Represents a local file or directory.
Definition juce_File.h:45
A lightweight object that can create a stream to read some kind of resource.
The base class for streams that read data.
The base class for streams that write data to some kind of destination.
An array designed for holding objects.
Represents the 'success' or 'failure' of an operation, and holds an associated error message to descr...
Definition juce_Result.h:57
The JUCE String class!
Definition juce_String.h:53
Holds an absolute date and time.
Definition juce_Time.h:37
Used to create a new zip file.
Decodes a ZIP file from a stream.
String filename
The name of the file, which may also include a partial pathname.
int64 uncompressedSize
The file's original size.
uint32 externalFileAttributes
Platform specific data.
bool isSymbolicLink
True if the zip entry is a symbolic link.
Time fileTime
The last time the file was modified.
Contains information about one of the entries in a ZipFile.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
unsigned int uint32
A platform-independent 32-bit unsigned integer type.
long long int64
A platform-independent 64-bit integer type.