This repository was archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCOSchemaTemplate.m
More file actions
51 lines (43 loc) · 1.33 KB
/
COSchemaTemplate.m
File metadata and controls
51 lines (43 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#import "COSchemaTemplate.h"
#import "COType.h"
#import <EtoileFoundation/Macros.h>
@implementation COSchemaTemplate
@synthesize name = name_;
@synthesize parent = parent_;
@synthesize typeForAttribute = typeForAttribute_;
@synthesize schemaNameForAttribute = schemaNameForAttribute_;
- (id) initWithName: (NSString *)aName
{
SUPERINIT;
ASSIGN(name_, aName);
typeForAttribute_ = [[NSMutableDictionary alloc] init];
schemaNameForAttribute_ = [[NSMutableDictionary alloc] init];
return self;
}
- (void) dealloc
{
[name_ release];
[parent_ release];
[typeForAttribute_ release];
[schemaNameForAttribute_ release];
[super dealloc];
}
+ (COSchemaTemplate *) schemaWithName: (NSString *) aName
{
return [[[self alloc] initWithName: aName] autorelease];
}
- (void) setType: (COType)aType
schemaName: (NSString *)aSchema
forProperty: (NSString *)aProperty
{
NSParameterAssert(COPrimitiveType(aType) == kCOCompositeReferenceType
|| COPrimitiveType(aType) == kCOReferenceType);
[typeForAttribute_ setObject: aType forKey: aProperty];
[schemaNameForAttribute_ setObject: [NSString stringWithString: aSchema] forKey: aProperty];
}
- (void) setType: (COType)aType
forProperty: (NSString *)aProperty
{
[typeForAttribute_ setObject: aType forKey: aProperty];
}
@end