2 Copyright (C) 2000-2005 SKYRIX Software AG
4 This file is part of SOPE.
6 SOPE 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 SOPE 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 SOPE; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __EOControl_EOClassDescription_H__
23 #define __EOControl_EOClassDescription_H__
25 #import <Foundation/Foundation.h>
26 #include <EOControl/EOGlobalID.h>
28 @class NSException, NSString, NSFormatter;
30 @interface EOClassDescription : NSClassDescription
34 @interface NSClassDescription(EOClassDescription)
38 - (NSString *)entityName;
39 - (NSString *)inverseForRelationshipKey:(NSString *)_key;
40 - (NSClassDescription *)classDescriptionForDestinationKey:(NSString *)_key;
42 /* object initialization */
44 - (id)createInstanceWithEditingContext:(id)_ec
45 globalID:(EOGlobalID *)_oid
48 - (void)awakeObject:(id)_object fromFetchInEditingContext:(id)_ec;
49 - (void)awakeObject:(id)_object fromInsertionInEditingContext:(id)_ec;
53 - (void)propagateDeleteForObject:(id)_object editingContext:(id)_ec;
58 // used by: EOGenericRecord.m
59 + (NSClassDescription *)classDescriptionForEntityName:(NSString *)_entityName;
64 - (NSFormatter *)defaultFormatterForKey:(NSString *)_key;
65 - (NSFormatter *)defaultFormatterForKeyPath:(NSString *)_keyPath;
69 @interface NSClassDescription(EOValidation)
71 - (NSException *)validateObjectForDelete:(id)_object;
72 - (NSException *)validateObjectForSave:(id)_object;
73 - (NSException *)validateValue:(id *)_value forKey:(NSString *)_key;
77 @interface NSObject(EOClassDescriptionInit)
79 /* object initialization */
81 - (id)initWithEditingContext:(id)_ec
82 classDescription:(NSClassDescription *)_classDesc
83 globalID:(EOGlobalID *)_oid;
85 - (void)awakeFromFetchInEditingContext:(id)_ec;
86 - (void)awakeFromInsertionInEditingContext:(id)_ec;
90 - (NSString *)entityName;
91 - (NSString *)inverseForRelationshipKey:(NSString *)_key;
92 - (NSArray *)attributeKeys;
93 - (NSArray *)toManyRelationshipKeys;
94 - (NSArray *)toOneRelationshipKeys;
96 - (BOOL)isToManyKey:(NSString *)_key;
97 - (NSArray *)allPropertyKeys;
101 - (void)propagateDeleteWithEditingContext:(id)_ec;
107 @interface NSObject(EOValidation)
109 - (NSException *)validateForDelete;
110 - (NSException *)validateForInsert;
111 - (NSException *)validateForUpdate;
112 - (NSException *)validateForSave;
116 @interface NSException(EOValidation)
118 + (NSException *)aggregateExceptionWithExceptions:(NSArray *)_exceptions;
124 @interface NSObject(EOSnapshots)
126 - (NSDictionary *)snapshot;
127 - (void)updateFromSnapshot:(NSDictionary *)_snapshot;
128 - (NSDictionary *)changesFromSnapshot:(NSDictionary *)_snapshot;
134 @interface NSObject(EORelationshipManipulation)
136 - (void)addObject:(id)_o toBothSidesOfRelationshipWithKey:(NSString *)_key;
137 - (void)removeObject:(id)_o fromBothSidesOfRelationshipWithKey:(NSString *)_key;
139 - (void)addObject:(id)_object toPropertyWithKey:(NSString *)_key;
140 - (void)removeObject:(id)_object fromPropertyWithKey:(NSString *)_key;
144 /* shallow array copying */
146 @interface NSArray(ShallowCopy)
150 #endif /* __EOControl_EOClassDescription_H__ */