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;
42 @interface EOExpressionArray : NSObject < NSMutableCopying >
45 NSMutableArray *array;
51 /* Initializing instances */
52 - (id)initWithPrefix:(NSString*)prefix
53 infix:(NSString*)infix
54 suffix:(NSString*)suffix;
56 /* Accessing the components */
57 - (void)setPrefix:(NSString*)prefix;
59 - (void)setInfix:(NSString*)infix;
61 - (void)setSuffix:(NSString*)suffix;
64 /* Checking contents */
65 - (BOOL)referencesObject:(id)anObject;
67 - (NSString *)expressionValueForContext:(id<EOExpressionContext>)ctx;
69 + (EOExpressionArray *)parseExpression:(NSString *)expression
70 entity:(EOEntity *)entity
71 replacePropertyReferences:(BOOL)flag;
73 + (EOExpressionArray *)parseExpression:(NSString *)expression
74 entity:(EOEntity *)entity
75 replacePropertyReferences:(BOOL)flag
76 relationshipPaths:(NSMutableArray *)relationshipPaths;
78 // array compatibility
80 - (void)addObjectsFromExpressionArray:(EOExpressionArray *)_array;
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;
88 - (unsigned int)count;
89 - (NSEnumerator *)objectEnumerator;
90 - (NSEnumerator *)reverseObjectEnumerator;
92 @end /* EOExpressionArray */
95 @interface NSObject (EOExpression)
96 - (NSString*)expressionValueForContext:(id<EOExpressionContext>)context;
99 #endif /* __EOExpressionArray_h__ */