PageRenderTime 136ms CodeModel.GetById 57ms app.highlight 45ms RepoModel.GetById 1ms app.codeStats 0ms

/XADMaster.framework/Versions/A/Headers/XADArchiveParser.h

https://code.google.com/p/xee/
C Header | 188 lines | 145 code | 40 blank | 3 comment | 0 complexity | c63b0287ad7e219f389ba3ec2e14677b MD5 | raw file
  1#import <Foundation/Foundation.h>
  2#import "XADException.h"
  3#import "XADString.h"
  4#import "XADPath.h"
  5#import "XADRegex.h"
  6#import "CSHandle.h"
  7#import "XADSkipHandle.h"
  8#import "Checksums.h"
  9
 10extern NSString *XADFileNameKey;
 11extern NSString *XADFileSizeKey;
 12extern NSString *XADCompressedSizeKey;
 13extern NSString *XADLastModificationDateKey;
 14extern NSString *XADLastAccessDateKey;
 15extern NSString *XADLastAttributeChangeDateKey;
 16extern NSString *XADCreationDateKey;
 17extern NSString *XADFileTypeKey;
 18extern NSString *XADFileCreatorKey;
 19extern NSString *XADFinderFlagsKey;
 20extern NSString *XADFinderInfoKey;
 21extern NSString *XADPosixPermissionsKey;
 22extern NSString *XADPosixUserKey;
 23extern NSString *XADPosixGroupKey;
 24extern NSString *XADPosixUserNameKey;
 25extern NSString *XADPosixGroupNameKey;
 26extern NSString *XADDOSFileAttributesKey;
 27extern NSString *XADWindowsFileAttributesKey;
 28extern NSString *XADAmigaProtectionBitsKey;
 29
 30extern NSString *XADIsEncryptedKey;
 31extern NSString *XADIsCorruptedKey;
 32extern NSString *XADIsDirectoryKey;
 33extern NSString *XADIsResourceForkKey;
 34extern NSString *XADIsArchiveKey;
 35extern NSString *XADIsHiddenKey;
 36extern NSString *XADIsLinkKey;
 37extern NSString *XADIsHardLinkKey;
 38extern NSString *XADLinkDestinationKey;
 39extern NSString *XADIsCharacterDeviceKey;
 40extern NSString *XADIsBlockDeviceKey;
 41extern NSString *XADDeviceMajorKey;
 42extern NSString *XADDeviceMinorKey;
 43extern NSString *XADIsFIFOKey;
 44
 45extern NSString *XADCommentKey;
 46extern NSString *XADDataOffsetKey;
 47extern NSString *XADDataLengthKey;
 48extern NSString *XADSkipOffsetKey;
 49extern NSString *XADSkipLengthKey;
 50extern NSString *XADCompressionNameKey;
 51
 52extern NSString *XADIsSolidKey;
 53extern NSString *XADFirstSolidEntryKey;
 54extern NSString *XADNextSolidEntryKey;
 55extern NSString *XADSolidObjectKey;
 56extern NSString *XADSolidOffsetKey;
 57extern NSString *XADSolidLengthKey;
 58
 59// Archive properties only
 60extern NSString *XADArchiveNameKey;
 61extern NSString *XADVolumesKey;
 62extern NSString *XADDiskLabelKey;
 63
 64@interface XADArchiveParser:NSObject
 65{
 66	CSHandle *sourcehandle;
 67	XADSkipHandle *skiphandle;
 68
 69	id delegate;
 70	NSString *password;
 71
 72	NSMutableDictionary *properties;
 73	XADStringSource *stringsource;
 74
 75	id parsersolidobj;
 76	NSMutableDictionary *firstsoliddict,*prevsoliddict;
 77	id currsolidobj;
 78	CSHandle *currsolidhandle;
 79
 80	BOOL shouldstop;
 81
 82	NSAutoreleasePool *autopool;
 83}
 84
 85+(void)initialize;
 86+(Class)archiveParserClassForHandle:(CSHandle *)handle firstBytes:(NSData *)header
 87name:(NSString *)name propertiesToAdd:(NSMutableDictionary *)props;
 88+(XADArchiveParser *)archiveParserForHandle:(CSHandle *)handle name:(NSString *)name;
 89+(XADArchiveParser *)archiveParserForHandle:(CSHandle *)handle firstBytes:(NSData *)header name:(NSString *)name;
 90+(XADArchiveParser *)archiveParserForPath:(NSString *)filename;
 91
 92-(id)initWithHandle:(CSHandle *)handle name:(NSString *)name;
 93-(void)dealloc;
 94
 95-(NSDictionary *)properties;
 96-(NSString *)name;
 97-(NSString *)filename;
 98-(NSArray *)allFilenames;
 99-(BOOL)isEncrypted;
100
101-(id)delegate;
102-(void)setDelegate:(id)newdelegate;
103
104-(NSString *)password;
105-(BOOL)hasPassword;
106-(void)setPassword:(NSString *)newpassword;
107
108-(XADStringSource *)stringSource;
109
110-(XADString *)linkDestinationForDictionary:(NSDictionary *)dict;
111-(NSData *)finderInfoForDictionary:(NSDictionary *)dict;
112
113
114
115// Internal functions
116
117+(NSArray *)scanForVolumesWithFilename:(NSString *)filename
118regex:(XADRegex *)regex firstFileExtension:(NSString *)firstext;
119
120-(BOOL)shouldKeepParsing;
121
122-(CSHandle *)handle;
123-(CSHandle *)handleAtDataOffsetForDictionary:(NSDictionary *)dict;
124-(XADSkipHandle *)skipHandle;
125-(CSHandle *)zeroLengthHandleWithChecksum:(BOOL)checksum;
126-(CSHandle *)subHandleFromSolidStreamForEntryWithDictionary:(NSDictionary *)dict;
127
128-(NSArray *)volumes;
129-(off_t)offsetForVolume:(int)disk offset:(off_t)offset;
130
131-(void)setObject:(id)object forPropertyKey:(NSString *)key;
132-(void)addPropertiesFromDictionary:(NSDictionary *)dict;
133-(void)setIsMacArchive:(BOOL)ismac;
134
135-(void)addEntryWithDictionary:(NSMutableDictionary *)dict;
136-(void)addEntryWithDictionary:(NSMutableDictionary *)dict retainPosition:(BOOL)retainpos;
137-(void)addEntryWithDictionary:(NSMutableDictionary *)dict cyclePools:(BOOL)cyclepools;
138-(void)addEntryWithDictionary:(NSMutableDictionary *)dict retainPosition:(BOOL)retainpos cyclePools:(BOOL)cyclepools;
139
140-(XADString *)XADStringWithString:(NSString *)string;
141-(XADString *)XADStringWithData:(NSData *)data;
142-(XADString *)XADStringWithData:(NSData *)data encodingName:(NSString *)encoding;
143-(XADString *)XADStringWithBytes:(const void *)bytes length:(int)length;
144-(XADString *)XADStringWithBytes:(const void *)bytes length:(int)length encodingName:(NSString *)encoding;
145-(XADString *)XADStringWithCString:(const char *)cstring;
146-(XADString *)XADStringWithCString:(const char *)cstring encodingName:(NSString *)encoding;
147
148-(XADPath *)XADPath;
149-(XADPath *)XADPathWithString:(NSString *)string;
150-(XADPath *)XADPathWithUnseparatedString:(NSString *)string;
151-(XADPath *)XADPathWithData:(NSData *)data separators:(const char *)separators;
152-(XADPath *)XADPathWithData:(NSData *)data encodingName:(NSString *)encoding separators:(const char *)separators;
153-(XADPath *)XADPathWithBytes:(const void *)bytes length:(int)length separators:(const char *)separators;
154-(XADPath *)XADPathWithBytes:(const void *)bytes length:(int)length encodingName:(NSString *)encoding separators:(const char *)separators;
155-(XADPath *)XADPathWithCString:(const char *)cstring separators:(const char *)separators;
156-(XADPath *)XADPathWithCString:(const char *)cstring encodingName:(NSString *)encoding separators:(const char *)separators;
157
158-(NSData *)encodedPassword;
159-(const char *)encodedCStringPassword;
160
161
162// Subclasses implement these:
163
164+(int)requiredHeaderSize;
165+(BOOL)recognizeFileWithHandle:(CSHandle *)handle firstBytes:(NSData *)data
166name:(NSString *)name;
167+(BOOL)recognizeFileWithHandle:(CSHandle *)handle firstBytes:(NSData *)data
168name:(NSString *)name propertiesToAdd:(NSMutableDictionary *)props;
169+(NSArray *)volumesForHandle:(CSHandle *)handle firstBytes:(NSData *)data
170name:(NSString *)name;
171
172-(void)parse;
173-(CSHandle *)handleForEntryWithDictionary:(NSDictionary *)dict wantChecksum:(BOOL)checksum;
174-(NSString *)formatName;
175
176-(CSHandle *)handleForSolidStreamWithObject:(id)obj wantChecksum:(BOOL)checksum;
177
178@end
179
180@interface NSObject (XADArchiveParserDelegate)
181
182-(void)archiveParser:(XADArchiveParser *)parser foundEntryWithDictionary:(NSDictionary *)dict;
183-(BOOL)archiveParsingShouldStop:(XADArchiveParser *)parser;
184-(void)archiveParserNeedsPassword:(XADArchiveParser *)parser;
185
186@end
187
188NSMutableArray *XADSortVolumes(NSMutableArray *volumes,NSString *firstfileextension);