2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #ifndef __EOControl_EOClassDescription_H__
24 #define __EOControl_EOClassDescription_H__
26 #import <Foundation/Foundation.h>
27 #include <EOControl/EOGlobalID.h>
29 @class NSException, NSString, NSFormatter;
31 @interface EOClassDescription : NSClassDescription
35 @interface NSClassDescription(EOClassDescription)
39 - (NSString *)entityName;
40 - (NSString *)inverseForRelationshipKey:(NSString *)_key;
41 - (NSClassDescription *)classDescriptionForDestinationKey:(NSString *)_key;
43 /* object initialization */
45 - (id)createInstanceWithEditingContext:(id)_ec
46 globalID:(EOGlobalID *)_oid
49 - (void)awakeObject:(id)_object fromFetchInEditingContext:(id)_ec;
50 - (void)awakeObject:(id)_object fromInsertionInEditingContext:(id)_ec;
54 - (void)propagateDeleteForObject:(id)_object editingContext:(id)_ec;
59 // used by: EOGenericRecord.m
60 + (NSClassDescription *)classDescriptionForEntityName:(NSString *)_entityName;
65 - (NSFormatter *)defaultFormatterForKey:(NSString *)_key;
66 - (NSFormatter *)defaultFormatterForKeyPath:(NSString *)_keyPath;
70 @interface NSClassDescription(EOValidation)
72 - (NSException *)validateObjectForDelete:(id)_object;
73 - (NSException *)validateObjectForSave:(id)_object;
74 - (NSException *)validateValue:(id *)_value forKey:(NSString *)_key;
78 @interface NSObject(EOClassDescriptionInit)
80 /* object initialization */
82 - (id)initWithEditingContext:(id)_ec
83 classDescription:(NSClassDescription *)_classDesc
84 globalID:(EOGlobalID *)_oid;
86 - (void)awakeFromFetchInEditingContext:(id)_ec;
87 - (void)awakeFromInsertionInEditingContext:(id)_ec;
91 - (NSString *)entityName;
92 - (NSString *)inverseForRelationshipKey:(NSString *)_key;
93 - (NSArray *)attributeKeys;
94 - (NSArray *)toManyRelationshipKeys;
95 - (NSArray *)toOneRelationshipKeys;
97 - (BOOL)isToManyKey:(NSString *)_key;
98 - (NSArray *)allPropertyKeys;
102 - (void)propagateDeleteWithEditingContext:(id)_ec;
108 @interface NSObject(EOValidation)
110 - (NSException *)validateForDelete;
111 - (NSException *)validateForInsert;
112 - (NSException *)validateForUpdate;
113 - (NSException *)validateForSave;
117 @interface NSException(EOValidation)
119 + (NSException *)aggregateExceptionWithExceptions:(NSArray *)_exceptions;
125 @interface NSObject(EOSnapshots)
127 - (NSDictionary *)snapshot;
128 - (void)updateFromSnapshot:(NSDictionary *)_snapshot;
129 - (NSDictionary *)changesFromSnapshot:(NSDictionary *)_snapshot;
135 @interface NSObject(EORelationshipManipulation)
137 - (void)addObject:(id)_o toBothSidesOfRelationshipWithKey:(NSString *)_key;
138 - (void)removeObject:(id)_o fromBothSidesOfRelationshipWithKey:(NSString *)_key;
140 - (void)addObject:(id)_object toPropertyWithKey:(NSString *)_key;
141 - (void)removeObject:(id)_object fromPropertyWithKey:(NSString *)_key;
145 /* shallow array copying */
147 @interface NSArray(ShallowCopy)
151 #endif /* __EOControl_EOClassDescription_H__ */