14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
-
+
+
+
-
+
-
+
-
-
+
+
-
+
+
+
-
+
-
+
|
* file.
*/
#import "OFObject.h"
#import "OFString.h"
@class OFFile;
@class OFDictionary;
@class OFArray;
@class OFMutableArray;
@class OFMutableDictionary;
@class OFStream;
/*!
* @brief A class for accessing and manipulating ZIP files.
*/
@interface OFZIPArchive: OFObject
{
OFFile *_file;
OFString *_path;
uint16_t _diskNumber, _centralDirectoryDisk;
uint16_t _centralDirectoryEntriesInDisk, _centralDirectoryEntries;
uint32_t _centralDirectorySize, _centralDirectoryOffset;
OFString *_archiveComment;
OFMutableArray *_entries;
OFMutableDictionary *_entries;
OFMutableDictionary *_pathToEntryMap;
}
#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *archiveComment;
@property (readonly, copy) OFDictionary *entries;
@property (readonly, copy) OFArray *entries;
#endif
/*!
* @brief Creates a new OFZIPArchive object for the specified file.
*
* @param path The path to the ZIP file
* @return A new, autoreleased OFZIPArchive
*/
+ (instancetype)archiveWithPath: (OFString*)path;
/*!
* @brief Initializes an already allocated OFZIPArchive object for the
* specified file.
*
* @param path The path to the ZIP file
* @return An initialized OFZIPArchive
*/
- initWithPath: (OFString*)path;
/*!
* @brief Returns the entries in the central directory of the archive as a
* dictionary.
* @brief Returns the entries of the central directory of the archive as an
* array of objects of class @ref OFZIPArchiveEntry.
*
* The dictionary maps the file name to an @ref OFZIPArchiveEntry.
* The array is sorted by the offset of the local file header, smallest offset
* to largest offset. This way, hard disk seeks are minimized when the array is
* enumerated to extract all files of the archive.
*
* @return The entries in the central directory of the archive as a dictionary
* @return The entries of the central directory of the archive as an array
*/
- (OFDictionary*)entries;
- (OFArray*)entries;
/*!
* @brief Returns the archive comment.
*
* @return The archive comment
*/
- (OFString*)archiveComment;
|