1 /* 2 3 Archive.h 4 Zipper 5 6 Copyright (C) 2012 Free Software Foundation, Inc 7 8 Authors: Dirk Olmes <dirk@xanthippe.ping.de> 9 Riccardo Mottola <rm@gnu.org> 10 11 This application is free software; you can redistribute it and/or modify it 12 under the terms of the GNU General Public License as published by the Free 13 Software Foundation; either version 2 of the License, or (at your option) 14 any later version. 15 16 This program is distributed in the hope that it will be useful, but 17 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 18 or FITNESS FOR A PARTICULAR PURPOSE. 19 See the GNU General Public License for more details 20 21 */ 22 23 #import <Foundation/NSObject.h> 24 #import <common.h> 25 26 #ifdef __MACTYPES__ 27 #define FileInfo FinderFileInfo 28 #endif 29 30 @class NSString, FileInfo, NSArray; 31 32 typedef enum 33 { 34 SortByPath = 1, 35 SortBySize = 2, 36 SortByFilename = 4, 37 SortByDate = 8, 38 SortByRatio = 16 39 } SortByOptions; 40 41 @interface Archive : NSObject 42 { 43 @private 44 NSArray *_elements; 45 NSString *_path; 46 SortByOptions _sortAttribute; 47 NSComparisonResult _sortOrder; 48 } 49 50 + (Archive *)newWithPath:(NSString *)path; 51 - (id)initWithPath:(NSString *)path; 52 - (NSString *)path; 53 54 - (NSArray *)listContents; 55 56 - (void)sortByPath; 57 - (void)sortBySize; 58 - (void)sortByFilename; 59 - (void)sortByDate; 60 - (void)sortByRatio; 61 - (NSComparisonResult)sortOrder; 62 63 - (int)elementCount; 64 - (FileInfo *)elementAtIndex:(int)index; 65 - (NSArray *)elements; 66 - (void)setElements:(NSArray *)elements; 67 68 + (BOOL)executableDoesExist; 69 + (NSString *)archiveExecutable; 70 + (NSString *)unarchiveExecutable; 71 - (int)expandFiles:(NSArray *)files withPathInfo:(BOOL)usePathInfo toPath:(NSString *)path; 72 - (NSData *)dataByRunningUnachiverWithArguments:(NSArray *)args; 73 74 + (int)runArchiverWithArguments:(NSArray *)args inDirectory:(NSString *)workDir; 75 + (int)runUnarchiverWithArguments:(NSArray *)args inDirectory:(NSString *)workDir; 76 - (int)runUnarchiverWithArguments:(NSArray *)args; 77 - (int)runUnarchiverWithArguments:(NSArray *)args inDirectory:(NSString *)workDir; 78 79 + (BOOL)hasRatio; 80 + (BOOL)canExtractWithoutFullPath; 81 + (ArchiveType)archiveType; 82 + (NSData *)magicBytes; 83 84 + (void)registerFileExtension:(NSString *)extension forArchiveClass:(Class)clazz; 85 + (Class)classForFileExtension:(NSString *)fileExtension; 86 + (NSArray *)allFileExtensions; 87 + (NSArray *)allArchivers; 88 89 @end 90