]> err.no Git - sope/blob - sope-gdl1/GDLAccess/EOExpressionArray.h
added missing inline pathes
[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   Notes
43   
44   In LSExtendedSearchCommand this is bound to the 'content' of EOSQLQualifier
45   and contains an array like:
46
47     "(", "(", "(", LOWER, "(", { allowsNull=Y; columnName=name; width=50;...},
48     ...
49     " = ", 0, ")", ")"
50
51   so it seems to be a stream of tokens and an EOAttribute mixed in for column
52   keys.
53   
54   Apparently only EOSQLExpression supports the 'EOExpressionContext'?
55 */
56
57 @interface EOExpressionArray : NSObject < NSMutableCopying >
58 {
59 @protected
60     NSMutableArray *array;
61     NSString       *prefix;
62     NSString       *infix;
63     NSString       *suffix;
64 }
65
66 /* Initializing instances */
67 - (id)initWithPrefix:(NSString*)prefix
68   infix:(NSString*)infix
69   suffix:(NSString*)suffix;
70
71 /* Accessing the components */
72 - (void)setPrefix:(NSString*)prefix;
73 - (NSString*)prefix;
74 - (void)setInfix:(NSString*)infix;
75 - (NSString*)infix;
76 - (void)setSuffix:(NSString*)suffix;
77 - (NSString*)suffix;
78
79 /* Checking contents */
80 - (BOOL)referencesObject:(id)anObject;
81
82 - (NSString *)expressionValueForContext:(id<EOExpressionContext>)ctx;
83
84 + (EOExpressionArray *)parseExpression:(NSString *)expression
85         entity:(EOEntity *)entity
86         replacePropertyReferences:(BOOL)flag;
87
88 + (EOExpressionArray *)parseExpression:(NSString *)expression
89         entity:(EOEntity *)entity
90         replacePropertyReferences:(BOOL)flag
91         relationshipPaths:(NSMutableArray *)relationshipPaths;
92
93 // array compatibility
94
95 - (void)addObjectsFromExpressionArray:(EOExpressionArray *)_array;
96
97 - (void)insertObject:(id)_obj atIndex:(unsigned int)_idx;
98 - (void)addObjectsFromArray:(NSArray *)_array;
99 - (void)addObject:(id)_object;
100 - (unsigned int)indexOfObject:(id)_object;
101 - (id)objectAtIndex:(unsigned int)_idx;
102 - (id)lastObject;
103 - (unsigned int)count;
104 - (NSEnumerator *)objectEnumerator;
105 - (NSEnumerator *)reverseObjectEnumerator;
106
107 @end /* EOExpressionArray */
108
109
110 @interface NSObject (EOExpression)
111 - (NSString *)expressionValueForContext:(id<EOExpressionContext>)context;
112 @end
113
114 #endif /* __EOExpressionArray_h__ */
115
116 /*
117   Local Variables:
118   c-basic-offset: 4
119   tab-width: 8
120   End:
121 */