ObjFW
OFZIPArchive.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
3  * Jonathan Schleifer <js@heap.zone>
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 @class OFArray OF_GENERIC(ObjectType);
24 @class OFMutableArray OF_GENERIC(ObjectType);
25 @class OFMutableDictionary OF_GENERIC(KeyType, ObjectType);
26 @class OFSeekableStream;
27 @class OFStream;
28 
35 {
36  OFSeekableStream *_stream;
37  uint32_t _diskNumber, _centralDirectoryDisk;
38  uint64_t _centralDirectoryEntriesInDisk, _centralDirectoryEntries;
39  uint64_t _centralDirectorySize;
40  int64_t _centralDirectoryOffset;
41  OFString *_Nullable _archiveComment;
42  OFMutableArray OF_GENERIC(OFZIPArchiveEntry *) *_entries;
44  *_pathToEntryMap;
45  OFStream *_Nullable _lastReturnedStream;
46 }
47 
51 @property (readonly, nonatomic) OFString *archiveComment;
52 
59 + (instancetype)archiveWithSeekableStream: (OFSeekableStream *)stream;
60 
61 #ifdef OF_HAVE_FILES
62 
68 + (instancetype)archiveWithPath: (OFString *)path;
69 #endif
70 
71 - init OF_UNAVAILABLE;
72 
80 - initWithSeekableStream: (OFSeekableStream *)stream OF_DESIGNATED_INITIALIZER;
81 
82 #ifdef OF_HAVE_FILES
83 
90 - initWithPath: (OFString *)path;
91 #endif
92 
103 - (OFArray OF_GENERIC(OFZIPArchiveEntry *) *)entries;
104 
115 - (OFStream *)streamForReadingFile: (OFString *)path;
116 @end
117 
118 OF_ASSUME_NONNULL_END
A class for handling strings.
Definition: OFString.h:114
OFString * archiveComment
Definition: OFZIPArchive.h:51
id init()
Initializes an already allocated object.
Definition: OFObject.m:488
A stream that supports seeking.
Definition: OFSeekableStream.h:57
An abstract class for storing and changing objects in a dictionary.
Definition: OFMutableDictionary.h:39
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:379
OFArray * entries()
Returns the entries of the central directory of the archive as an array of objects of class OFZIPArch...
Definition: OFZIPArchive.m:319
An abstract class for storing objects in an array.
Definition: OFArray.h:89
An abstract class for storing, adding and removing objects in an array.
Definition: OFMutableArray.h:40
A class for accessing and manipulating ZIP files.
Definition: OFZIPArchive.h:34
A base class for different types of streams.
Definition: OFStream.h:88