ObjFW
OFZIPArchive.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 #import "OFString.h"
19 #import "OFZIPArchiveEntry.h"
20 
21 OF_ASSUME_NONNULL_BEGIN
22 
23 #ifndef DOXYGEN
24 @class OFArray OF_GENERIC(ObjectType);
25 @class OFMutableArray OF_GENERIC(ObjectType);
26 @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
27 #endif
28 @class OFSeekableStream;
29 @class OFStream;
30 
37 {
38  OFSeekableStream *_stream;
39  uint32_t _diskNumber, _centralDirectoryDisk;
40  uint64_t _centralDirectoryEntriesInDisk, _centralDirectoryEntries;
41  uint64_t _centralDirectorySize, _centralDirectoryOffset;
42  OFString *_archiveComment;
43  OFMutableArray OF_GENERIC(OFZIPArchiveEntry*) *_entries;
45  *_pathToEntryMap;
46  OFStream *_lastReturnedStream;
47 }
48 
49 #ifdef OF_HAVE_PROPERTIES
50 @property (readonly, copy) OFString *archiveComment;
51 @property (readonly, copy) OFArray OF_GENERIC(OFZIPArchiveEntry*) *entries;
52 #endif
53 
60 + (instancetype)archiveWithSeekableStream: (OFSeekableStream*)stream;
61 
68 + (instancetype)archiveWithPath: (OFString*)path;
69 
77 - initWithSeekableStream: (OFSeekableStream*)stream;
78 
86 - initWithPath: (OFString*)path;
87 
98 - (OFArray OF_GENERIC(OFZIPArchiveEntry*)*)entries;
99 
105 - (OFString*)archiveComment;
106 
117 - (OFStream*)streamForReadingFile: (OFString*)path;
118 @end
119 
120 OF_ASSUME_NONNULL_END
A class for handling strings.
Definition: OFString.h:91
A stream that supports seeking.
Definition: OFSeekableStream.h:51
An abstract class for storing and changing objects in a dictionary.
Definition: OFMutableDictionary.h:47
A class which represents an entry in the central directory of a ZIP archive.
Definition: OFZIPArchiveEntry.h:90
The root class for all other classes inside ObjFW.
Definition: OFObject.h:364
An abstract class for storing objects in an array.
Definition: OFArray.h:95
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:46
A class for accessing and manipulating ZIP files.
Definition: OFZIPArchive.h:36
A base class for different types of streams.
Definition: OFStream.h:86