Skip to content
This repository was archived by the owner on Jun 9, 2019. It is now read-only.

Commit a336977

Browse files
committedJun 3, 2017
Add definitions for resource attributes.
These are the attributes that can be applied to the resource file/fork or the resource themselves. These are not yet bound to anything, or affecting functionality. Not all of these are applicable on a system that isn't Mac OS Classic, and others such as the compact flag are implemented in an unknown way.
1 parent 10cea7b commit a336977

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed
 

‎ResourceKit/Builders/RKResourceBuilder.m

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ + (nullable RKResource *)buildFromPOD:(nullable RKResourcePOD *)pod
3838
RKResource *resource = [RKResource ofType:[RKType withCode:pod.typeCode] withId:pod.id];
3939
resource.name = pod.name;
4040
resource.data = pod.data;
41+
resource.attributes = pod.flags;
4142
return resource;
4243
}
4344

‎ResourceKit/Model/RKResource.h

+13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@
2424

2525
#import <Foundation/Foundation.h>
2626

27+
typedef NS_ENUM(NSUInteger, RKResourceAttributes)
28+
{
29+
RKResourceSystemHeap = 0x40,
30+
RKResourcePurgable = 0x20,
31+
RKResourceLocked = 0x10,
32+
RKResourceProtected = 0x08,
33+
RKResourcePreload = 0x04,
34+
RKResourceChanged = 0x02
35+
};
36+
2737
@class RKType;
2838

2939
@interface RKResource : NSObject
@@ -40,6 +50,9 @@
4050
/// The actual resource data of the receiver.
4151
@property (nullable, atomic, strong) NSData *data;
4252

53+
/// The attributes of the resource.
54+
@property (atomic, assign) RKResourceAttributes attributes;
55+
4356

4457
/// Create a new resource with the specified ID and type
4558
+ (nonnull instancetype)ofType:(nonnull RKType *)type withId:(int16_t)id;

‎ResourceKit/Model/RKResourceFile.h

+10
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,21 @@
2424

2525
#import <ResourceKit/RKResourceContainer.h>
2626

27+
typedef NS_ENUM(NSUInteger, RKResourceForkAttributes)
28+
{
29+
RKResourceForkReadOnly = 0x80,
30+
RKResourceForkCompact = 0x40,
31+
RKResourceForkChanged = 0x20,
32+
};
33+
2734
@interface RKResourceFile : NSObject <RKResourceContainer>
2835

2936
/// The location of the file on disk.
3037
@property (nonnull, atomic, strong, readonly) NSString *path;
3138

39+
/// The Resource Fork attributes.
40+
@property (atomic, assign) RKResourceForkAttributes attributes;
41+
3242
/// Initialise a new resource file at the specified file path. This will
3343
/// kick off parsing the resource fork immediately, and if parsing
3444
/// fails the initialiser will return nil.

‎ResourceKit/Model/RKResourceFile.m

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ - (BOOL)parse
8383
}
8484

8585
// Build all the actual structures from the PODs
86+
_attributes = resourceFilePod.mainFlags;
8687
_types = [[RKTypeBuilder buildFromArrayOfPODs:resourceFilePod.typePods] mutableCopy];
8788

8889
NSArray <RKResource *> *allResources = [RKResourceBuilder buildFromArrayOfPODs:resourceFilePod.resourcePods];

0 commit comments

Comments
 (0)
This repository has been archived.