]> err.no Git - sope/blob - sope-gdl1/GDLAccess/EOExpressionArray.h
fixed bug in GDL adaptor lookup
[sope] / sope-gdl1 / GDLAccess / EOExpressionArray.h
1 /* 
2    EOExpressionArray.h
3
4    Copyright (C) 1996 Free Software Foundation, Inc.
5
6    Author: Ovidiu Predescu <ovidiu@bx.logicnet.ro>
7    Date: September 1996
8
9    This file is part of the GNUstep Database Library.
10
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.
15
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.
20
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.
25 */
26
27 #ifndef __EOExpressionArray_h__
28 #define __EOExpressionArray_h__
29
30 #import <Foundation/NSString.h>
31
32 @class EOAttribute, EOEntity, EOExpressionArray;
33
34 @protocol EOExpressionContext <NSObject>
35
36 - (NSString *)expressionValueForAttribute:(EOAttribute *)anAttribute;
37 - (NSString *)expressionValueForAttributePath:(NSArray *)path;
38
39 @end
40
41
42 @interface EOExpressionArray : NSObject < NSMutableCopying >
43 {
44 @protected
45     NSMutableArray *array;
46     NSString       *prefix;
47     NSString       *infix;
48     NSString       *suffix;
49 }
50
51 /* Initializing instances */
52 - (id)initWithPrefix:(NSString*)prefix
53   infix:(NSString*)infix
54   suffix:(NSString*)suffix;
55
56 /* Accessing the components */
57 - (void)setPrefix:(NSString*)prefix;
58 - (NSString*)prefix;
59 - (void)setInfix:(NSString*)infix;
60 - (NSString*)infix;
61 - (void)setSuffix:(NSString*)suffix;
62 - (NSString*)suffix;
63
64 /* Checking contents */
65 - (BOOL)referencesObject:(id)anObject;
66
67 - (NSString*)expressionValueForContext:(id<EOExpressionContext>)ctx;
68
69 + (EOExpressionArray*)parseExpression:(NSString*)expression
70         entity:(EOEntity*)entity
71         replacePropertyReferences:(BOOL)flag;
72
73 + (EOExpressionArray*)parseExpression:(NSString*)expression
74         entity:(EOEntity*)entity
75         replacePropertyReferences:(BOOL)flag
76         relationshipPaths:(NSMutableArray *)relationshipPaths;
77
78 // array compatibility
79
80 - (void)addObjectsFromExpressionArray:(EOExpressionArray *)_array;
81
82 - (void)insertObject:(id)_obj atIndex:(unsigned int)_idx;
83 - (void)addObjectsFromArray:(NSArray *)_array;
84 - (void)addObject:(id)_object;
85 - (unsigned int)indexOfObject:(id)_object;
86 - (id)objectAtIndex:(unsigned int)_idx;
87 - (id)lastObject;
88 - (unsigned int)count;
89 - (NSEnumerator *)objectEnumerator;
90 - (NSEnumerator *)reverseObjectEnumerator;
91
92 @end /* EOExpressionArray */
93
94
95 @interface NSObject (EOExpression)
96 - (NSString*)expressionValueForContext:(id<EOExpressionContext>)context;
97 @end
98
99 #endif /* __EOExpressionArray_h__ */
100
101 /*
102   Local Variables:
103   c-basic-offset: 4
104   tab-width: 8
105   End:
106 */