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 pathCOStore2.m
More file actions
62 lines (51 loc) · 1.32 KB
/
COStore2.m
File metadata and controls
62 lines (51 loc) · 1.32 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
52
53
54
55
56
57
58
59
60
61
62
#import "COStore.h"
#import "COMacros.h"
#import "COPersistentRootPrivate.h"
#import "COSQLiteStore.h"
@implementation COStore
- (id)initWithStore: (COSQLiteStore*)aStore
{
self = [super init];
rootForUUID_ = [[NSMutableDictionary alloc] init];
ASSIGN(store_, aStore);
return self;
}
- (COSQLiteStore*)store
{
return store_;
}
- (void)dealloc
{
[store_ release];
[rootForUUID_ release];
[super dealloc];
}
- (void) fetchPersistentRoots
{
if (rootForUUID_ == nil)
{
{
[self cachePersistentRootEditPlist: [store_ persistentRootWithUUID: uuid]];
}
}
}
- (COPersistentRoot *) cachePersistentRootEditPlist: (COPersistentRootState *)persistentRoot
{
[self fetchPersistentRoots];
COPersistentRoot *root = [[[COPersistentRoot alloc] initWithStoreEditQueue: self
persistentRoot: persistentRoot] autorelease];
[rootForUUID_ setObject: root forKey: [root UUID]];
return root;
}
- (NSSet *) persistentRoots
{
[self fetchPersistentRoots];
return [NSSet setWithArray: [rootForUUID_ allValues]];
}
- (COPersistentRoot *) persistentRootWithUUID: (COUUID *)aUUID
{
[self fetchPersistentRoots];
COPersistentRoot *root = [rootForUUID_ objectForKey: aUUID];
return root;
}
@end