4 Copyright (C) 1996 Free Software Foundation, Inc.
6 Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
9 This file is part of the GNUstep Database Library.
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Library General Public
13 License as published by the Free Software Foundation; either
14 version 2 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Library General Public License for more details.
21 You should have received a copy of the GNU Library General Public
22 License along with this library; see the file COPYING.LIB.
23 If not, write to the Free Software Foundation,
24 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #ifndef __EOAttribute_h__
28 #define __EOAttribute_h__
30 #import <Foundation/NSString.h>
31 #import <Foundation/NSDictionary.h>
32 #import <Foundation/NSDate.h>
34 @class NSString, NSTimeZone, NSDate, NSException;
35 @class NSMutableArray;
38 @interface EOAttribute : NSObject
41 NSString *calendarFormat;
42 NSTimeZone *clientTimeZone;
43 NSTimeZone *serverTimeZone;
46 NSString *externalType;
47 NSString *valueClassName;
49 NSString *insertFormat;
50 NSString *selectFormat;
51 NSString *updateFormat;
52 NSDictionary *userDictionary;
54 /* Garbage collectable objects */
55 EOEntity *entity; /* non-retained */
56 NSMutableArray *definitionArray; // These variables are meaningful only
57 EOAttribute *realAttribute; // if the attribute is flattened
68 /* Initializing new instances */
69 - (id)initWithName:(NSString*)name;
71 /* Accessing the entity */
72 - (void)setEntity:(EOEntity*)entity;
77 /* Accessing the name */
78 - (BOOL)setName:(NSString*)name;
80 + (BOOL)isValidName:(NSString*)name;
82 /* Accessing date information */
83 + (NSString*)defaultCalendarFormat;
84 - (void)setCalendarFormat:(NSString*)format;
85 - (NSString*)calendarFormat;
86 - (void)setClientTimeZone:(NSTimeZone*)tz;
87 - (NSTimeZone*)clientTimeZone;
88 - (void)setServerTimeZone:(NSTimeZone*)tz;
89 - (NSTimeZone*)serverTimeZone;
91 /* Accessing external definitions */
92 - (void)setColumnName:(NSString*)columnName;
93 - (NSString*)columnName;
94 - (void)setDefinition:(NSString*)definition;
95 - (NSString*)definition;
96 - (NSMutableArray*)definitionArray;
97 - (void)setExternalType:(NSString*)type;
98 - (NSString*)externalType;
100 /* Accessing value type information */
101 - (void)setValueClassName:(NSString*)name;
102 - (NSString*)valueClassName;
103 - (void)setValueType:(NSString*)type;
104 - (NSString*)valueType;
106 /* Checking type information */
107 - (BOOL)referencesProperty:property;
110 - (BOOL)setReadOnly:(BOOL)flag;
113 /* Accessing SQL statement formats */
114 - (void)setInsertFormat:(NSString*)string;
115 - (NSString*)insertFormat;
116 - (void)setSelectFormat:(NSString*)string;
117 - (NSString*)selectFormat;
118 - (void)setUpdateFormat:(NSString*)string;
119 - (NSString*)updateFormat;
121 /* Accessing the user dictionary */
122 - (void)setUserDictionary:(NSDictionary*)dictionary;
123 - (NSDictionary*)userDictionary;
125 /* Obsolete. This method always return NO, because you should always release
127 - (BOOL)referencesProperty:property;
132 @interface EOAttribute (EOAttributePrivate)
134 + (EOAttribute*)attributeFromPropertyList:(id)propertyList;
135 - (void)replaceStringsWithObjects;
138 @end /* EOAttribute (EOAttributePrivate) */
140 @interface EOAttribute(ValuesConversion)
142 - (id)convertValue:(id)aValue
143 toClass:(Class)aClass
144 forType:(NSString *)aValueType;
145 - (id)convertValueToModel:(id)aValue;
147 @end /* EOAttribute (ValuesConversion) */
149 @interface NSString (EOAttributeTypeCheck)
151 - (BOOL)isNameOfARelationshipPath;
155 @class NSMutableDictionary;
157 @interface EOAttribute(PropertyListCoding)
159 - (void)encodeIntoPropertyList:(NSMutableDictionary *)_plist;
163 @interface EOAttribute(EOF2Additions)
165 - (void)beautifyName;
169 - (void)setAllowsNull:(BOOL)_flag;
171 - (void)setWidth:(unsigned)_width;
174 - (NSException *)validateValue:(id *)_value;
176 - (NSString *)readFormat;
177 - (NSString *)writeFormat;
181 #endif /* __EOAttribute_h__ */