openshot-audio
0.1.7
JuceLibraryCode
modules
juce_core
zip
juce_ZipFile.h
Go to the documentation of this file.
1
/*
2
==============================================================================
3
4
This file is part of the juce_core module of the JUCE library.
5
Copyright (c) 2015 - ROLI Ltd.
6
7
Permission to use, copy, modify, and/or distribute this software for any purpose with
8
or without fee is hereby granted, provided that the above copyright notice and this
9
permission notice appear in all copies.
10
11
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18
------------------------------------------------------------------------------
19
20
NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21
All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22
using any other modules, be sure to check that you also comply with their license.
23
24
For more details, visit www.juce.com
25
26
==============================================================================
27
*/
28
29
#ifndef JUCE_ZIPFILE_H_INCLUDED
30
#define JUCE_ZIPFILE_H_INCLUDED
31
32
33
//==============================================================================
40
class
JUCE_API
ZipFile
41
{
42
public
:
44
explicit
ZipFile
(
const
File
& file);
45
46
//==============================================================================
53
ZipFile
(
InputStream
* inputStream,
bool
deleteStreamWhenDestroyed);
54
59
explicit
ZipFile
(
InputStream
& inputStream);
60
66
explicit
ZipFile
(
InputSource
* inputSource);
67
69
~
ZipFile
();
70
71
//==============================================================================
77
struct
ZipEntry
78
{
80
String
filename
;
81
83
unsigned
int
uncompressedSize
;
84
86
Time
fileTime
;
87
};
88
89
//==============================================================================
91
int
getNumEntries() const
noexcept
;
92
97
const
ZipEntry
* getEntry (
int
index) const
noexcept
;
98
105
int
getIndexOfFileName (const
String
& fileName) const
noexcept
;
106
114
const
ZipEntry
* getEntry (const
String
& fileName) const
noexcept
;
115
117
void
sortEntriesByFilename();
118
119
//==============================================================================
133
InputStream
* createStreamForEntry (
int
index);
134
148
InputStream
* createStreamForEntry (const
ZipEntry
& entry);
149
150
//==============================================================================
160
Result
uncompressTo (const
File
& targetDirectory,
161
bool
shouldOverwriteFiles = true);
162
174
Result
uncompressEntry (
int
index,
175
const
File
& targetDirectory,
176
bool
shouldOverwriteFiles = true);
177
178
179
//==============================================================================
188
class
Builder
189
{
190
public
:
191
Builder
();
192
~
Builder
();
193
202
void
addFile (
const
File
& fileToAdd,
int
compressionLevel,
203
const
String
& storedPathName =
String
());
204
217
void
addEntry (
InputStream
* streamToRead,
int
compressionLevel,
218
const
String
& storedPathName,
Time
fileModificationTime);
219
224
bool
writeToStream (
OutputStream
& target,
double
* progress)
const
;
225
226
//==============================================================================
227
private
:
228
class
Item
;
229
friend
struct
ContainerDeletePolicy
<
Item
>;
230
OwnedArray<Item>
items;
231
232
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
Builder
)
233
};
234
235
private
:
236
//==============================================================================
237
class
ZipInputStream
;
238
class
ZipEntryHolder
;
239
friend
class
ZipInputStream
;
240
friend
class
ZipEntryHolder
;
241
242
OwnedArray<ZipEntryHolder>
entries;
243
CriticalSection
lock;
244
InputStream
* inputStream;
245
ScopedPointer<InputStream>
streamToDelete;
246
ScopedPointer<InputSource>
inputSource;
247
248
#if JUCE_DEBUG
249
struct
OpenStreamCounter
250
{
251
OpenStreamCounter() : numOpenStreams (0) {}
252
~OpenStreamCounter();
253
254
int
numOpenStreams;
255
};
256
257
OpenStreamCounter streamCounter;
258
#endif
259
260
void
init();
261
262
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
(
ZipFile
)
263
};
264
265
#endif // JUCE_ZIPFILE_H_INCLUDED
ZipFile::ZipEntry::uncompressedSize
unsigned int uncompressedSize
Definition:
juce_ZipFile.h:83
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition:
juce_PlatformDefs.h:198
ZipFile::ZipEntry
Definition:
juce_ZipFile.h:77
ContainerDeletePolicy
Definition:
juce_ContainerDeletePolicy.h:44
InputStream
Definition:
juce_InputStream.h:41
String
Definition:
juce_String.h:43
JUCE_API
#define JUCE_API
Definition:
juce_StandardHeader.h:139
ZipFile::ZipEntry::fileTime
Time fileTime
Definition:
juce_ZipFile.h:86
CriticalSection
Definition:
juce_CriticalSection.h:47
ScopedPointer< InputStream >
noexcept
#define noexcept
Definition:
juce_CompilerSupport.h:141
File
Definition:
juce_File.h:45
ZipFile::ZipEntry::filename
String filename
Definition:
juce_ZipFile.h:80
Result
Definition:
juce_Result.h:61
ZipFile::ZipEntryHolder
Definition:
juce_ZipFile.cpp:29
ZipFile::Builder::Item
Definition:
juce_ZipFile.cpp:444
ZipFile::ZipInputStream
Definition:
juce_ZipFile.cpp:114
OwnedArray
Definition:
juce_OwnedArray.h:55
ZipFile::Builder
Definition:
juce_ZipFile.h:188
Time
Definition:
juce_Time.h:41
OutputStream
Definition:
juce_OutputStream.h:42
ZipFile
Definition:
juce_ZipFile.h:40
InputSource
Definition:
juce_InputSource.h:42
Generated by
1.8.17