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 __EOExpressionArray_h__
28 #define __EOExpressionArray_h__
30 #import <Foundation/NSString.h>
32 @class EOAttribute, EOEntity, EOExpressionArray;
34 @protocol EOExpressionContext <NSObject>
36 - (NSString *)expressionValueForAttribute:(EOAttribute *)anAttribute;
37 - (NSString *)expressionValueForAttributePath:(NSArray *)path;
44 In LSExtendedSearchCommand this is bound to the 'content' of EOSQLQualifier
45 and contains an array like:
47 "(", "(", "(", LOWER, "(", { allowsNull=Y; columnName=name; width=50;...},
51 so it seems to be a stream of tokens and an EOAttribute mixed in for column
54 Apparently only EOSQLExpression supports the 'EOExpressionContext'?
57 @interface EOExpressionArray : NSObject < NSMutableCopying >
60 NSMutableArray *array;
66 /* Initializing instances */
67 - (id)initWithPrefix:(NSString*)prefix
68 infix:(NSString*)infix
69 suffix:(NSString*)suffix;
71 /* Accessing the components */
72 - (void)setPrefix:(NSString*)prefix;
74 - (void)setInfix:(NSString*)infix;
76 - (void)setSuffix:(NSString*)suffix;
79 /* Checking contents */
80 - (BOOL)referencesObject:(id)anObject;
82 - (NSString *)expressionValueForContext:(id<EOExpressionContext>)ctx;
84 + (EOExpressionArray *)parseExpression:(NSString *)expression
85 entity:(EOEntity *)entity
86 replacePropertyReferences:(BOOL)flag;
88 + (EOExpressionArray *)parseExpression:(NSString *)expression
89 entity:(EOEntity *)entity
90 replacePropertyReferences:(BOOL)flag
91 relationshipPaths:(NSMutableArray *)relationshipPaths;
93 // array compatibility
95 - (void)addObjectsFromExpressionArray:(EOExpressionArray *)_array;
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;
103 - (unsigned int)count;
104 - (NSEnumerator *)objectEnumerator;
105 - (NSEnumerator *)reverseObjectEnumerator;
107 @end /* EOExpressionArray */
110 @interface NSObject (EOExpression)
111 - (NSString *)expressionValueForContext:(id<EOExpressionContext>)context;
114 #endif /* __EOExpressionArray_h__ */