2001-10-19 19:41:13 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
2008-07-31 20:27:55 +00:00
|
|
|
#import "../Plug-Ins/ResKnifeResourceProtocol.h"
|
|
|
|
|
|
|
|
/*!
|
|
|
|
@class Resource
|
|
|
|
@author Nicholas Shanks
|
|
|
|
@abstract Encapsulates a single resource and all associated meta-data.
|
|
|
|
@description The Resource class fully complies with key-value coding, with the keys @"name", @"type", @"resID", @"attributes", @"data", @"dirty" and @"representedFork" available.
|
|
|
|
*/
|
2001-10-19 19:41:13 +00:00
|
|
|
|
2002-12-31 19:06:40 +00:00
|
|
|
@interface Resource : NSObject <NSCopying, NSCoding, ResKnifeResourceProtocol>
|
2001-10-19 19:41:13 +00:00
|
|
|
{
|
2002-02-02 11:31:28 +00:00
|
|
|
@private
|
2002-02-14 23:24:53 +00:00
|
|
|
// flags
|
|
|
|
BOOL dirty;
|
2003-04-03 15:38:42 +00:00
|
|
|
NSString *representedFork;
|
2002-02-14 23:24:53 +00:00
|
|
|
|
2001-10-19 19:41:13 +00:00
|
|
|
// resource information
|
|
|
|
NSString *name;
|
|
|
|
NSString *type;
|
|
|
|
NSNumber *resID; // signed short
|
|
|
|
NSNumber *attributes; // unsigned short
|
|
|
|
|
|
|
|
// the actual data
|
2002-02-14 23:24:53 +00:00
|
|
|
NSData *data;
|
2003-08-01 22:23:50 +00:00
|
|
|
|
2008-07-31 20:27:55 +00:00
|
|
|
// the document name for display to the user; updating this is the responsibility of the document itself
|
|
|
|
NSString *_docName;
|
2001-10-19 19:41:13 +00:00
|
|
|
}
|
|
|
|
|
2003-04-03 15:38:42 +00:00
|
|
|
// accessor methods not part of the protocol
|
2008-07-31 20:27:55 +00:00
|
|
|
- (void)_setName:(NSString *)newName;
|
2001-10-19 19:41:13 +00:00
|
|
|
- (void)setDirty:(BOOL)newValue;
|
2003-04-03 15:38:42 +00:00
|
|
|
- (NSString *)representedFork;
|
|
|
|
- (void)setRepresentedFork:(NSString *)forkName;
|
2008-07-31 20:27:55 +00:00
|
|
|
- (void)setDocumentName:(NSString *)docName;
|
2001-10-19 19:41:13 +00:00
|
|
|
|
2003-04-03 15:38:42 +00:00
|
|
|
// init methods
|
2001-10-19 19:41:13 +00:00
|
|
|
- (id)initWithType:(NSString *)typeValue andID:(NSNumber *)resIDValue;
|
|
|
|
- (id)initWithType:(NSString *)typeValue andID:(NSNumber *)resIDValue withName:(NSString *)nameValue andAttributes:(NSNumber *)attributesValue;
|
2002-02-14 23:24:53 +00:00
|
|
|
- (id)initWithType:(NSString *)typeValue andID:(NSNumber *)resIDValue withName:(NSString *)nameValue andAttributes:(NSNumber *)attributesValue data:(NSData *)dataValue;
|
2001-10-19 19:41:13 +00:00
|
|
|
|
2003-04-03 15:38:42 +00:00
|
|
|
// autoreleased resource methods
|
2001-10-19 19:41:13 +00:00
|
|
|
+ (id)resourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue;
|
|
|
|
+ (id)resourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue withName:(NSString *)nameValue andAttributes:(NSNumber *)attributesValue;
|
2002-02-14 23:24:53 +00:00
|
|
|
+ (id)resourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue withName:(NSString *)nameValue andAttributes:(NSNumber *)attributesValue data:(NSData *)dataValue;
|
2001-10-19 19:41:13 +00:00
|
|
|
|
2012-07-04 22:13:25 +00:00
|
|
|
+ (Resource *)getResourceOfType:(NSString *)typeValue andID:(NSNumber *)resIDValue inDocument:(NSDocument *)searchDoc;
|
|
|
|
|
2001-10-19 19:41:13 +00:00
|
|
|
@end
|