GNUstep Core Data  0.1
CoreDataHeaders.h
1 /* Universal implementation #include for the GNUstep
2  Core Data framework.
3  Copyright (C) 2005 Free Software Foundation, Inc.
4 
5  Written by: H. Nikolaus Schaller <hns@quantum-step.com>
6  Date: December 2007
7 
8  This file is part of the GNUstep Core Data framework.
9 
10  This library is free software; you can redistribute it and/or
11  modify it under the terms of the GNU Lesser General Public
12  License as published by the Free Software Foundation; either
13  version 2.1 of the License, or (at your option) any later version.
14 
15  This library is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with this library; if not, write to the Free
22  Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
23 */
24 
25 #ifndef GNUSTEP /* if and only if we are not compiling under GNUstep, should these be defined */
26 #ifndef ASSIGN
27 #define ASSIGN(VAR, VAL) [(VAR) autorelease], (VAR)=[(VAL) retain]
28 #endif
29 #ifndef DESTROY
30 #define DESTROY(VAR) [(VAR) release], (VAR)=nil
31 #endif
32 #ifndef TEST_RELEASE
33 #define TEST_RELEASE(VAR) if(VAR) [(VAR) release]
34 #endif
35 #ifndef _
36 #define _(STR) STR
37 #endif
38 #endif
39 
40 #import <CoreData/CoreData.h>
41 #import "CoreDataUtilities.h"
42 
43 @interface NSAttributeDescription (GSCoreDataPrivate)
44 
45 - (void) _setAttributeValueClassName: (NSString *) aClassName;
46 
47 @end
48 
49 @interface NSPropertyDescription (GSCoreDataPrivate)
50 
51 - (void) _setEntity: (NSEntityDescription *) entity;
52 - (void) _ensureEditableWithReason: (NSString *) aReason;
53 
54 @end
55 
56 @interface NSEntityDescription (GSCoreDataPrivate)
57 
58 - (void) _addReferenceToManagedObjectModel: (NSManagedObjectModel *) aModel;
59 - (NSDictionary *) _fetchedPropertiesByName;
60 - (NSDictionary *) _filteredPropertiesOfClass: (Class) aClass;
61 - (void) _removeReferenceToManagedObjectModel: (NSManagedObjectModel *) aModel;
62 - (void) _setSuperentity: (NSEntityDescription *) anEntityDescription; // private
63 
64 @end
65 
66 @interface NSManagedObject (GSCoreDataPrivate)
67 
68 - (id) _initAsFaultWithEntity: (NSEntityDescription *) entity
69  ownedByContext: (NSManagedObjectContext *) context;
70 
71 - (void) _setObjectID: (NSManagedObjectID *) newID;
72 
73 - (void) _setDeleted: (BOOL) flag;
74 - (void) _setFault: (BOOL) flag;
75 
76 - (void) _insertedIntoContext: (NSManagedObjectContext *) context;
77 - (void) _removedFromContext;
78 - (NSPropertyDescription *) _validatedPropertyForKey: (NSString *) key;
79 
83 - (NSArray *) _allPropertiesOfSubclass: (Class) aClass;
84 
85 - (BOOL) _validateValue: (id *) value
86  forKey: (NSString *) key
87  error: (NSError **) error
88  property: (NSPropertyDescription *) desc;
89 
90 - (id) _primitiveValueForKey: (NSString *) key doValidation: (BOOL) flag;
91 
92 - (void) _setPrimitiveValue: (id) value
93  forKey: (NSString *) key
94  doValidation: (BOOL) validationFlag;
95 
96 - (void) _fireFault;
97 
98 @end
99 
100 @interface NSManagedObjectID (GSCoreDataPrivate)
101 
102 - (BOOL) _isEqualToManagedObjectID: (NSManagedObjectID *) otherID;
103 
104  // initializes a temporary ID
105 - (id) _initWithEntity: (NSEntityDescription *) entity;
106 
107  // initializes a permanent ID
108 - (id) _initWithEntity: (NSEntityDescription *) entity
109  persistentStore: (GSPersistentStore *) persistentStore
110  value: (unsigned long long) value;
111 
112  // returns the ID's value
113 - (unsigned long long) _value;
114 
115 @end
116 
117 
118 @interface NSManagedObjectModel (GSCoreDataPrivate)
119 
120 #ifndef NO_GNUSTEP
121 // Convenience method.
122 - (id) _initWithContentsOfFile: (NSString *) aFilePath;
123 #endif
124 
125 #ifndef NO_GNUSTEP
126  // returns all configurations bound to their respective names in this model.
127 - (NSDictionary *) _configurationsByName;
128 #endif
129 #ifndef NO_GNUSTEP
130 
131 - (void) _removeFetchRequestTemplateForName: (NSString *) aName;
132 
133  // returns all fetch requests bound to their respective names in this model.
134 - (NSDictionary *) _fetchRequestsByName;
135 #endif
136 
137 #ifndef NO_GNUSTEP
138 
148 - (BOOL) _isEditable;
149 
150 #endif
151 
152 - (void) _incrementUseCount;
153 
154 - (void) _decrementUseCount;
155 
156 @end
157 
158 @interface NSPersistentStoreCoordinator (GSCoreDataPrivate)
159 
160 #ifndef NO_GNUSTEP
161 
170 + (void) _addPersistentStoreType: (NSString *) newStoreType
171  handledByClass: (Class) aClass;
172 
176 + (NSArray *) _supportedPersistentStoreTypes;
177 
178 #endif // NO_GNUSTEP
179 
180 @end
181 
182 
183 
Nn abstract superclass from which concrete implementations of various persistent store types are subc...
For implementation notes see "Documentation/NSManagedObjectID.txt" in the source distribution of the ...