From ba310e8b58d686ee9897b26a7edab5b778a8d96f Mon Sep 17 00:00:00 2001 From: jnj Date: Thu, 13 Nov 2008 18:59:12 +0000 Subject: Add remaining plugins git-svn-id: https://blacktree-elements-public.googlecode.com/svn/trunk@41 57e2f9b5-c12c-0410-8e95-a1ee7272c91a --- .../Versions/A/PrivateHeaders/NDResourceFork.h | 259 +++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 QSFoundation.framework/Versions/A/PrivateHeaders/NDResourceFork.h (limited to 'QSFoundation.framework/Versions/A/PrivateHeaders/NDResourceFork.h') diff --git a/QSFoundation.framework/Versions/A/PrivateHeaders/NDResourceFork.h b/QSFoundation.framework/Versions/A/PrivateHeaders/NDResourceFork.h new file mode 100644 index 0000000..7b25747 --- /dev/null +++ b/QSFoundation.framework/Versions/A/PrivateHeaders/NDResourceFork.h @@ -0,0 +1,259 @@ +/*! + @header NDResourceFork + @abstract Defines the interface for the class NDResourceFork. + @discussion NDResourceFork allows your cocoa application create, delete, open, read, modify, and write resources; get information about them. A resource is data of any kind stored in a defined format in a file's resource fork. On intialization, NDResourceFork open the resource fork and then closes the resource for when it is deallocated. + + Created by nathan on Wed Dec 05 2001. + Copyright © 2001 Nathan Day. All rights reserved. + */ + +#import +#import + +/*! + @class NDResourceFork + @abstract A class to access manipulate resource forks from Cocoa. + @discussion NDResourceFork allows your cocoa application create, delete, open, read, modify, and write resources; get information about them. A resource is data of any kind stored in a defined format in a file's resource fork. On intialization, NDResourceFork open the resource fork and then closes the resource for when it is deallocated. + */ +@interface NDResourceFork : NSObject +{ +@private + short int fileReference; +} + +/*! +@method resourceForkForReadingAtURL: + @abstract Creates and initalises a NDResourceFork. + @discussion Creates and intializes a NDResourceFork and opens a resource fork for reading using the file url.. The NDResourceFork resource fork is closed when the receiver is deallocated. + @param URL A file url specifying the name and location of the file whose resource fork is to be opened. + @result A NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or Create and initalise failed. + */ ++ (id)resourceForkForReadingAtURL:(NSURL *)URL; +/*! + @method resourceForkForWritingAtURL: + @abstract Creates and initalises a NDResourceFork. + @discussion Creates and intializes a NDResourceFork and opens a resource fork for writting, creating it before hand if it does not already exists, using the file url. The NDResourceFork resource fork is closed when the receiver is deallocated. + @param URL A file url specifying the name and location of the file whose resource fork is to be opened. + @result A NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or Create and initalise failed. + */ ++ (id)resourceForkForWritingAtURL:(NSURL *)URL; +/*! + @method resourceForkForReadingAtPath: + @abstract Creates and initalises a NDResourceFork. + @discussion Creates and intializes a NDResourceFork and opens a resource fork for reading using the path. The receivers resource fork is closed when the receiver is deallocated. + @param path A path specifying the name and location of the file whose resource fork is to be opened. + @result A NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or Create and initalise failed. + */ ++ (id)resourceForkForReadingAtPath:(NSString *)path; +/*! + @method resourceForkForWritingAtPath: + @abstract Creates and initalises a NDResourceFork. + @discussion Creates and intializes a NDResourceForkr and opens a resource fork for writting, creating it before hand if it does not already exists, using the path. The receivers resource fork is closed when the receiver is deallocated. + @param path A path specifying the name and location of the file whose resource fork is to be opened. + @result A NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or Create and initalise failed. + */ ++ (id)resourceForkForWritingAtPath:(NSString *)path; + +/*! + @method initForReadingAtURL: + @abstract Initalises a NDResourceFork. + @discussion Intializes the receiver and opens a resource fork for reading using the file url. + @param URL A file url specifying the name and location of the file whose resource fork is to be opened. The receivers resource fork is closed when the receiver is deallocated. + @result An initialized NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or initalization failed. + */ +- (id)initForReadingAtURL:(NSURL *)URL; +/*! + @method initForReadingAtURL: + @abstract Initalises a NDResourceFork. + @discussion Intializes the receiver and opens a resource fork for writting, creating it before hand if it does not already exists, using the file url. The receivers resource fork is closed when the receiver is deallocated. + @param URL A file url specifying the name and location of the file whose resource fork is to be opened. + @result An initialized NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or initalization failed. + */ +- (id)initForWritingAtURL:(NSURL *)URL; +/*! + @method initForReadingAtPath: + @abstract Initalises a NDResourceFork. + @discussion Intializes the receiver and opens a resource fork for reading using the path. The receivers resource fork is closed when the receiver is deallocated. + @param path A path specifying the name and location of the file whose resource fork is to be opened. + @result An initialized NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or initalization failed. + */ +- (id)initForReadingAtPath:(NSString *)path; +/*! + @method initForWritingAtPath: + @abstract Initalises a NDResourceFork. + @discussion Intializes the receiver and opens a resource fork for writting, creating it before hand if it does not already exists, using the path. The receivers resource fork is closed when the receiver is deallocated. + @param path A path specifying the name and location of the file whose resource fork is to be opened. + @result An initialized NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or initalization failed. + */ +- (id)initForWritingAtPath:(NSString *)path; +/*! + @method initForPermission:AtURL: + @abstract Initalises a NDResourceFork. + @discussion Intializes the receiver and opens a resource fork for reading and/or writting using the file url. If write permission is specified, then an empty resource fork created before hand if it does not already exists. The receivers resource fork is closed when the receiver is deallocated.Possible permission values are as follows; +
+ + + + + + + + + + + + + + + +
fsCurPermRequests whatever permissions are currently allowed. If write access in unavailable (because the file is locked or the file is already open with write permission), then read permission is granted. Otherwise read/write permission is granted.
fsRdPermRequests permission to read the file.
fsWrPermRequests permission to write to the file. If write permission is granted, no other access paths are granted write permission. Note, however, that the File Manager does not support write-only access to a file. Thus, fsWrPerm is synonymous with fsRdWrPerm .
fsRdWrPermRequests exclusive read and write permission. If exclusive read/ write permission is granted, no other users are granted permission to write to the file. Other users may, however, be granted permission to read the file.
fsRdWrShPermRequests shared read and write permission. Shared read/ write permission allows mutliple access paths for reading and writing. This is safe only if there is some way of locking portions of the file before writing to them. Use the functions PBLockRangeSync and PBUnlockRangeSync to lock and unlock ranges of bytes within a file. On Mac OS 8 and 9, these functions are supported only on remotely mounted volumes, or on local volumes that are shareable on the network. You should check that range locking is available before requesting shared read/ write permission. On Mac OS X, range locking is available on all volumes.
fsRdDenyPermRequests that any other paths be prevented from having read access. A path cannot be opened if you request read permission (with the fsRdPerm constant) but some other path has requested deny-read access. Similarly, the path cannot be opened if you request deny-read permission, but some other path already has read access. This constant is used with the PBHOpenDenySync and PBHOpenRFDenySync functions.
fsWrDenyPermRequests that any other paths be prevented from having write access. A path cannot be opened if you request write permission (with the fsWrPerm constant) but some other path has requested deny-write access. Similarly, the path cannot be opened if you request deny-write permission, but some other path already has write access. This constant is used with the PBHOpenDenySync and PBHOpenRFDenySync functions.
+
+ @param permission read/write permissions for the opened resource fork. + @param URL A file url specifying the name and location of the file whose resource fork is to be opened. + @result An initialized NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or initalization failed. + */ +- (id)initForPermission:(char)permission AtURL:(NSURL *)URL; +/*! + @method initForPermission:AtPath: + @abstract Initalises a NDResourceFork. + @discussion Intializes the receiver and opens a resource fork for reading and/or writting using the path. If write permission is specified, then an empty resource fork created before hand if it does not already exists. The receivers resource fork is closed when the receiver is deallocated. Possible permission values are as follows; +
+ + + + + + + + + + + + + + + +
fsCurPermRequests whatever permissions are currently allowed. If write access in unavailable (because the file is locked or the file is already open with write permission), then read permission is granted. Otherwise read/write permission is granted.
fsRdPermRequests permission to read the file.
fsWrPermRequests permission to write to the file. If write permission is granted, no other access paths are granted write permission. Note, however, that the File Manager does not support write-only access to a file. Thus, fsWrPerm is synonymous with fsRdWrPerm .
fsRdWrPermRequests exclusive read and write permission. If exclusive read/ write permission is granted, no other users are granted permission to write to the file. Other users may, however, be granted permission to read the file.
fsRdWrShPermRequests shared read and write permission. Shared read/ write permission allows mutliple access paths for reading and writing. This is safe only if there is some way of locking portions of the file before writing to them. Use the functions PBLockRangeSync and PBUnlockRangeSync to lock and unlock ranges of bytes within a file. On Mac OS 8 and 9, these functions are supported only on remotely mounted volumes, or on local volumes that are shareable on the network. You should check that range locking is available before requesting shared read/ write permission. On Mac OS X, range locking is available on all volumes.
fsRdDenyPermRequests that any other paths be prevented from having read access. A path cannot be opened if you request read permission (with the fsRdPerm constant) but some other path has requested deny-read access. Similarly, the path cannot be opened if you request deny-read permission, but some other path already has read access. This constant is used with the PBHOpenDenySync and PBHOpenRFDenySync functions.
fsWrDenyPermRequests that any other paths be prevented from having write access. A path cannot be opened if you request write permission (with the fsWrPerm constant) but some other path has requested deny-write access. Similarly, the path cannot be opened if you request deny-write permission, but some other path already has write access. This constant is used with the PBHOpenDenySync and PBHOpenRFDenySync functions.
+
+ @param permission read/write permissions for the opened resource fork. + @param path A path specifying the name and location of the file whose resource fork is to be opened. + @result An initialized NDResourceFork for an opened resource fork, returns nil if the resource fork could not be opened or initalization failed. + */ +- (id)initForPermission:(char)permission AtPath:(NSString *)path; + +/*! + @method addData:type:Id:name: + @abstract Adds a resource to the receivers resource file. + @discussion addData:type:name: doesn't verify whether the resource ID you pass in the parameter ID is already assigned to another resource of the same type. You should use the methods addData:type:name: or dataForType:named: to get a unique resource ID when adding a resource . addData:type:Id:named: returns YES on success + @param data An NSData object containing the data to be added as a resource to the receivers resource file. + @param type The resource type of the resource to be added. + @param ID The resource ID of the resource to be added. + @param name The name of the resource to be added. + @result Returns YES if the resource was successfully added, otherwise it returns NO. + */ +- (BOOL)addData:(NSData *)data type:(ResType)type Id:(short int)ID name:(NSString *)name; +/*! + @method addData:type:name: + @abstract Adds a resource to the receivers resource file. + @discussion addData:type:name: uses an unique resource ID when adding a resource . addData:type:Id:named: returns YES on success + @param data An NSData object containing the data to be added as a resource to the receivers resource file. + @param type The resource type of the resource to be added. + @param name The name of the resource to be added. + @result Returns YES if the resource was successfully added, otherwise it returns NO. + */ +- (BOOL)addData:(NSData *)data type:(ResType)type name:(NSString *)name; +/*! + @method dataForType:Id: + @abstract Gets resource data for a resource in the receivers resource file. + @discussion dataForType:Id: searches the receivers resource file's resource map in memory for the specified resource. + @param type The resource type of the resource which you wish to retrieve data. + @param ID An integer that uniquely identifies the resource which you wish to retrieve data. + @result Returns an NSData object if successful otherwise returns nil. + */ +- (NSData *)dataForType:(ResType)type Id:(short int)ID; +/*! + @method dataForType:named: + @abstract Gets resource data for a resource in the receivers resource file. + @discussion dataForType:Id: searches the receivers resource file's resource map in memory for the specified resource. + @param type The resource type of the resource which you wish to retrieve data. + @param name A name that uniquely identifies the resource which you wish to retrieve data. Strings passed in this parameter are case-sensitive. + @result Returns an NSData object if successful otherwise returns nil. + */ +- (NSData *)dataForType:(ResType)type named:(NSString *)name; + +/*! + @method removeType:Id: + @abstract Removes a resource's entry from the receivers resource file. + @discussion If the resProtected attribute for the resource is set, removeType:Id: does nothing, and returns NO. + @param type The resource type of the resource which you wish to remove. + @param ID An integer that uniquely identifies the resource which you wish to remove. + @result Returns YES if the resource was successfully removed, otherwise if returns NO. + */ +- (BOOL)removeType:(ResType)type Id:(short int)ID; + +/*! + @method everyResourceType + @abstract Gets every resource type available in the receivers resource file. + @discussion everyResourceType returns an NSArray of NSNumbers each containing a unsigned long or ResTypes. + @result A NSArray of NSNumbers containing ResTypes. + */ +- (NSArray *)everyResourceType; + +/*! + @method nameOfResourceType:Id: + @abstract Gets a resource's resource name. + @discussion Returns a resources name as an NSString. + @param type The resource type of the resource for which you wish to retrieve the name. + @param ID An integer that uniquely identifies the resource for which you wish to retrieve the name. + @result An NSString containing the resources name. + */ +- (NSString *)nameOfResourceType:(ResType)type Id:(short int)ID; +/*! + @method getId:ofResourceType:named: + @abstract Gets a named resource's resource id. + @discussion Returns a resources id in a pointer to a short int and returns YES if retrieval of the id is succeeded. If getId:ofResourceType:named: returns NO then the value returned through the pointer ID is garabage. + @param ID A pointer to an short int that on return contains the resources id, if the returned value is YES. + @param type The resource type of the resource for which you wish to retrieve the id. + @param name The resource name of the resource for which you wish to retrieve the id. + @result A YES if retrieval was successful. + */ +- (BOOL)getId:(short int *)ID ofResourceType:(ResType)type named:(NSString *)name; + +/*! + @method getAttributeFlags:forResourceType:Id: + @abstract Gets a resource's attributes. + @discussion Returns the attributes for a resource in a pointer to a short int and returns YES if retrieval of the attributes is succeeded. If getAttributeFlags:forResourceType:Id: returns NO then the value returned through the pointer attributes is garabage. + @param attributes A pointer to an short int that on return contains the resources attributes, if the returned value is YES. + @param type The resource type of the resource for which you wish to retrieve the attributes. + @param ID An integer that uniquely identifies the resource for which you wish to retrieve the attributes. + @result A YES if retrieval was successful. + */ +- (BOOL)getAttributeFlags:(short int*)attributes forResourceType:(ResType)type Id:(short int)ID; +/*! + @method setAttributeFlags:forResourceType:Id: + @abstract Sets a resource's attributes. + @discussion Set the attributes for a resource in attributes and returns YES if setting of the attributes is succeeded. + @param attributes A short int that contains the resources attributes to be set. + @param type The resource type of the resource for which you wish to set the attributes. + @param ID An integer that uniquely identifies the resource for which you wish to set the attributes. + @result A YES if setAttributeFlags:forResourceType:Id: was successful in setting the resources attributes. + */ +- (BOOL)setAttributeFlags:(short int)attributes forResourceType:(ResType)type Id:(short int)ID; + +/*! + @method dataForEntireResourceFork + @abstract Reads the receivers entire resource data. + @discussion dataForEntireResourceFork returns a NSData object that contains the entire contents of the resource fork. dataForEntireResourceFork and it's conpanion method writeEntireResourceFork can be used for duplicating the resource fork for on file to the resource fork of another. dataForEntireResourceFork can also be used to convert a resource stored in a files resource fork into a resource stored in a data fork, simple by using the NSData methods writeToFile:atomically: or writeToURL:atomically:. + @result A NSData object containing the resources data. + */ +- (NSData *)dataForEntireResourceFork; +/*! + @method writeEntireResourceFork: + @abstract Writes complete resource data to the receivers resource fork. + @discussion writeEntireResourceFork: writes the data in the NSData object out the the recievers resource fork. writeEntireResourceFork and it's conpanion method dataForEntireResourceFork can be used for duplicating the resource fork for on file to the resource fork of another. writeEntireResourceFork: can also be used to convert a resource stored in a files data fork into a resource stored in a files resource fork, simple by creating the NSData object with the methods dataWithContentsOfFile or dataWithContentsOfURL:. + @param data The complete resource data in a NSData object. + @result Returns YES if writting was successful, returns NO otherwise. + */ +- (BOOL)writeEntireResourceFork:(NSData *)data; + +@end -- cgit