GNUstep Core Data
0.1
|
00001 /* Interface of the NSManagedObject class for the GNUstep 00002 Core Data framework. 00003 Copyright (C) 2005 Free Software Foundation, Inc. 00004 00005 Written by: Saso Kiselkov <diablos@manga.sk> 00006 Date: August 2005 00007 00008 This file is part of the GNUstep Core Data framework. 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free 00022 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. 00023 */ 00024 00025 #ifndef _NSManagedObject_h_ 00026 #define _NSManagedObject_h_ 00027 00028 #import <Foundation/NSObject.h> 00029 #import <Foundation/NSArray.h> // temporary workaround for 00030 // NSKeyValueObserving.h include bug 00031 #import <Foundation/NSKeyValueObserving.h> 00032 00033 @class NSString, NSMutableDictionary, NSDictionary, NSSet, NSError; 00034 @class NSManagedObjectContext, NSEntityDescription, NSManagedObjectID; 00035 00036 @interface NSManagedObject : NSObject 00037 { 00038 // weak reference 00039 NSManagedObjectContext * _context; 00040 00041 NSEntityDescription * _entity; 00042 NSManagedObjectID * _objectID; 00043 BOOL _isUpdated, 00044 _isDeleted, 00045 _isFault; 00046 00047 NSMutableDictionary * _changedValues; 00048 00049 // the actual data payload of a managed object 00050 NSMutableDictionary * _data; 00051 } 00052 00053 + (BOOL) automaticallyNotifiesObserversForKey: (NSString *) aKey; 00054 00055 // The designated initializer. 00056 - (id) initWithEntity: (NSEntityDescription *) anEntity 00057 insertIntoManagedObjectContext: (NSManagedObjectContext *) aContext; 00058 00059 // Determining the object's identity. 00060 - (NSManagedObjectContext *) managedObjectContext; 00061 - (NSEntityDescription *) entity; 00062 - (NSManagedObjectID *) objectID; 00063 00064 // State information 00065 - (BOOL) isInserted; 00066 - (BOOL) isUpdated; 00067 - (BOOL) isDeleted; 00068 - (BOOL) isFault; 00069 00070 // Life cycle and change management 00071 - (void) awakeFromFetch; 00072 - (void) awakeFromInsert; 00073 - (NSDictionary *) changedValues; 00074 - (NSDictionary *) commitedValuesForKeys: (NSArray *) someKeys; 00075 - (void) didSave; 00076 - (void) willSave; 00077 - (void) didTurnIntoFault; 00078 00079 // Key-value coding 00080 - (id) valueForKey: (NSString *) aKey; 00081 - (void) setValue: (id) aValue forKey: (NSString *) aKey; 00082 - (id) primitiveValueForKey: (NSString *) aKey; 00083 - (void) setPrimitiveValue: (id) aPrimitiveValue forKey: (NSString *) aKey; 00084 00085 // Validation 00086 - (BOOL) validateValue: (id *) value 00087 forKey: (NSString *) aKey 00088 error: (NSError **) anErrorPointer; 00089 - (BOOL) validateForDelete: (NSError **) anErrorPointer; 00090 - (BOOL) validateForInsert: (NSError **) anErrorPointer; 00091 - (BOOL) validateForUpdate: (NSError **) anErrorPointer; 00092 00093 // Key-value observing 00094 - (void) didAccessValueForKey: (NSString *) aKey; 00095 - (void) didChangeValueForKey: (NSString *) aKey; 00096 - (void) didChangeValueForKey: (NSString *) aKey 00097 withSetMutation: (NSKeyValueSetMutationKind) aMutationKind 00098 usingObjects: (NSSet *) someObjects; 00099 - (void *) observationInfo; 00100 - (void) setObservationInfo: (void *) someInfo; 00101 - (void) willAccessValueForKey: (NSString *) aKey; 00102 - (void) willChangeValueForKey: (NSString *) aKey; 00103 - (void) willChangeValueForKey: (NSString *) aKey 00104 withSetMutation: (NSKeyValueSetMutationKind) aMutationKind 00105 usingObjects: (NSSet *) someObjects; 00106 00107 @end 00108 00109 #endif // _NSManagedObject_h_