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;
45 NSString *externalType;
46 NSString *valueClassName;
48 NSDictionary *userDictionary;
49 EOEntity *entity; /* non-retained */
58 /* Initializing new instances */
59 - (id)initWithName:(NSString *)name;
61 /* Accessing the entity */
62 - (void)setEntity:(EOEntity*)entity;
67 /* Accessing the name */
68 - (BOOL)setName:(NSString *)name;
70 + (BOOL)isValidName:(NSString *)name;
72 /* Accessing date information */
73 + (NSString *)defaultCalendarFormat;
74 - (void)setCalendarFormat:(NSString *)format;
75 - (NSString *)calendarFormat;
76 - (void)setClientTimeZone:(NSTimeZone*)tz;
77 - (NSTimeZone*)clientTimeZone;
78 - (void)setServerTimeZone:(NSTimeZone*)tz;
79 - (NSTimeZone*)serverTimeZone;
81 /* Accessing external definitions */
82 - (void)setColumnName:(NSString *)columnName;
83 - (NSString *)columnName;
84 - (void)setExternalType:(NSString *)type;
85 - (NSString *)externalType;
87 /* Accessing value type information */
88 - (void)setValueClassName:(NSString *)name;
89 - (NSString *)valueClassName;
90 - (void)setValueType:(NSString *)type;
91 - (NSString *)valueType;
93 /* Checking type information */
94 - (BOOL)referencesProperty:property;
96 /* Accessing the user dictionary */
97 - (void)setUserDictionary:(NSDictionary*)dictionary;
98 - (NSDictionary*)userDictionary;
100 /* Obsolete. This method always return NO, because you should always release
102 - (BOOL)referencesProperty:property;
107 @interface EOAttribute (EOAttributePrivate)
109 + (EOAttribute*)attributeFromPropertyList:(id)propertyList;
110 - (void)replaceStringsWithObjects;
113 @end /* EOAttribute (EOAttributePrivate) */
115 @interface EOAttribute(ValuesConversion)
117 - (id)convertValue:(id)aValue
118 toClass:(Class)aClass
119 forType:(NSString *)aValueType;
120 - (id)convertValueToModel:(id)aValue;
122 @end /* EOAttribute (ValuesConversion) */
124 @interface NSString (EOAttributeTypeCheck)
126 - (BOOL)isNameOfARelationshipPath;
130 @class NSMutableDictionary;
132 @interface EOAttribute(PropertyListCoding)
134 - (void)encodeIntoPropertyList:(NSMutableDictionary *)_plist;
138 @interface EOAttribute(EOF2Additions)
140 - (void)beautifyName;
144 - (void)setAllowsNull:(BOOL)_flag;
146 - (void)setWidth:(unsigned)_width;
149 - (NSException *)validateValue:(id *)_value;
153 #endif /* __EOAttribute_h__ */