// // TKResource.h // ThemeKit // // Created by Colin Cornaby on Mon Dec 08 2003. // Copyright (c) 2003 Carpe Stellarem. All rights reserved. // /*! @class @abstract Base class for all ThemeKit resources. @discussion This class serves as the template for all resources in ThemeKit. TKResource is a subclass of TKManagedObject, and as such is compatible with any TKManagedObject methods. */ #import #import "TKResource.h" #import "TKMDManagedObject.h" @interface TKResource : TKMDManagedObject { NSMutableData *myData; NSString *resourceName; int resID; id delegate; } /*! @method endianness @abstract Returns what byte order the resource data is @discussion This method will return kBigEndian if the resource data is big endian encoded. Returns kLittleEndian if the resource is little endian encoded. Defaults to kBigEndian. */ - (int)endianness; /*! @method owner @abstract Returns the appskin this resource is a member of. @discussion Returns the TKAppSkin this resource is a member of. Every resource must be a member of an application skin. */ -(NSString *)owner; /*! @method appVersion @abstract Returns the target application version. @discussion Returns the version of the application this meant is meant to apply on. This key is optional and may be nil. Defaults to nil. */ -(NSString *)appVersion; /*! @method setAppVersion: @abstract Sets the application version for the resource @discussion Takes an application version as a NSString and sets the target application version to the passed value. */ -(void)setAppVersion:(NSString *)appVersion; /*! @method setAppVersion: @abstract Mutator method for resource's name @discussion Sets the resources name to the passed NSString. */ -(void)setResourceName:(NSString *)passedName; /*! @method resourceName @abstract Accessor method for resource's name @discussion If the resource was created from a file, returns the resource's file name. Otherwise, returns the name the resource had when it was contained in a resource fork. May be nil. */ -(NSString *)resourceName; /*! @method resourceID @abstract Accessor method for resource's id @discussion Returns the id the resource had when contained in a resource fork. If the resource has no id, returns 0. Is not guaranteed unique. */ -(int)resourceID; /*! @method setResourceID: @abstract Mutator method for resource's id @discussion Sets the id of the resource. */ -(void)setResourceID:(int)resID; /*! @method resourceData @abstract Accessor method for resource's data @discussion Returns the resource's original data, not swapped. */ -(NSData *)resourceData; /*! @method resourceDataForPlatform: @abstract Accessor method for swapped resource's data @discussion Returns the resource's swapped data. Pass kNativeEndian to pass a resource swapped for the current platform. Passing kBigEndian will return the resource swapped for big endian (PowerPC), and passing kLittleEndian will return the resource swapped for little endian platforms (Intel). */ -(NSData *)resourceDataForPlatform:(int)platform; /*! @method setResourceData: @abstract Accessor method for swapped resource's data @discussion Returns the resource's swapped data. Pass kNativeEndian to pass a resource swapped for the current platform. Passing kBigEndian will return the resource swapped for big endian (PowerPC), and passing kLittleEndian will return the resource swapped for little endian platforms (Intel). */ -(void)setResourceData:(NSData *)someData dataEndianness:(TKEndianness)endianness; -(void)setResourceData:(NSData *)someData; /*! @method humanReadableType @abstract Method to return human readable type. @discussion This method returns an NSString meant to describe the resource type to an end user. This is significantly less messier than telling the user this resource is a TKPXMResource. */ -(NSString *)humanReadableType; /*! @method delegate @abstract Returns the delegate for the resource. @discussion Method will return the delegate that has been assigned to this resource. */ -(id)delegate; /*! @method setDelegate: @abstract Sets the delegate for this resource. @discussion The resources delegate will be notified of events such as the resource's data changing. */ -(void)setDelegate:(id)newDelegate; /*! @method setOriginalResourceHash: @abstract Sets the hash for the original resource. @discussion The purpose of this function is to create a hash to pair the resource against it's Aqua counterpart. This system is under review as it can cause issues if the user has manually replaced files within their system. Ideally this method should only be called on the resources initial creation. */ -(void)setOriginalResourceHash:(NSData *)appVersion; /*! @method originalResourceHash @abstract Accessor for the original resource hash. @discussion This method returns the hash of the Aqua resource paired with this resource. Specifications for the hash will be released at a later time, and the hashing system is currently under review. */ -(NSData *)originalResourceHash; -(NSNumber *)resourceIDAsNumber; -(void)setStatus:(NSNumber *)status; -(NSNumber *)status; @end