2002-11-15 22:57:05 +00:00
|
|
|
/**
|
|
|
|
EOAndQualifier.m <title>EOAndQualifier Class</title>
|
|
|
|
|
|
|
|
Copyright (C) 2000-2002 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Author: Mirko Viviani <mirko.viviani@rccr.cremona.it>
|
|
|
|
Date: February 2000
|
|
|
|
|
|
|
|
Author: Manuel Guesdon <mguesdon@orange-concept.com>
|
|
|
|
Date: January 2002
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
$Date$
|
|
|
|
|
|
|
|
<abstract></abstract>
|
|
|
|
|
|
|
|
This file is part of the GNUstep Database Library.
|
|
|
|
|
|
|
|
<license>
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; see the file COPYING.LIB.
|
|
|
|
If not, write to the Free Software Foundation,
|
|
|
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
</license>
|
|
|
|
**/
|
|
|
|
|
2002-12-31 16:25:21 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
RCS_ID("$Id$")
|
2002-11-15 22:57:05 +00:00
|
|
|
|
2003-03-31 00:24:15 +00:00
|
|
|
#ifndef NeXT_Foundation_LIBRARY
|
|
|
|
#include <Foundation/NSDictionary.h>
|
|
|
|
#include <Foundation/NSSet.h>
|
|
|
|
#include <Foundation/NSUtilities.h>
|
|
|
|
#include <Foundation/NSDebug.h>
|
|
|
|
#else
|
|
|
|
#include <Foundation/Foundation.h>
|
2003-05-02 17:00:23 +00:00
|
|
|
#include <gnustep/base/GSObjCRuntime.h>
|
2003-03-31 00:24:15 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <EOControl/EOQualifier.h>
|
|
|
|
#include <EOControl/EODebug.h>
|
2002-11-15 22:57:05 +00:00
|
|
|
|
2002-12-30 22:10:43 +00:00
|
|
|
|
2002-11-15 22:57:05 +00:00
|
|
|
@implementation EOAndQualifier
|
|
|
|
|
2003-02-13 11:39:01 +00:00
|
|
|
/**
|
|
|
|
* Returns an autoreleased EOAndQualifier consisting of the provided array of
|
|
|
|
* qualifiers. This method calls [EOAndQualifier-initWithQualifierArray:].
|
|
|
|
*/
|
|
|
|
+ (EOQualifier *) qualifierWithQualifierArray: (NSArray *)array
|
2002-11-15 22:57:05 +00:00
|
|
|
{
|
2003-02-04 15:17:07 +00:00
|
|
|
return AUTORELEASE([[self alloc] initWithQualifierArray: array]);
|
2002-11-15 22:57:05 +00:00
|
|
|
}
|
|
|
|
|
2003-02-13 11:39:01 +00:00
|
|
|
/**
|
|
|
|
* Returns an autoreleased EOAndQualifier consisting of the provided
|
|
|
|
* nil terminated list of qualifiers. This method calls
|
|
|
|
* [EOAndQualifier-initWithQualifierArray:].
|
|
|
|
*/
|
|
|
|
+ (EOQualifier *) qualifierWithQualifiers: (EOQualifier *)qualifiers, ...
|
2002-11-15 22:57:05 +00:00
|
|
|
{
|
2003-05-02 17:00:23 +00:00
|
|
|
NSArray *qualArray;
|
2002-11-15 22:57:05 +00:00
|
|
|
|
2003-05-02 17:00:23 +00:00
|
|
|
GS_USEIDLIST(qualifiers, qualArray
|
|
|
|
= AUTORELEASE([[NSArray alloc] initWithObjects: __objects
|
|
|
|
count: __count]));
|
2002-11-15 22:57:05 +00:00
|
|
|
|
2003-02-04 15:17:07 +00:00
|
|
|
return AUTORELEASE([[self alloc] initWithQualifierArray: qualArray]);
|
2002-11-15 22:57:05 +00:00
|
|
|
}
|
|
|
|
|
2003-02-13 11:39:01 +00:00
|
|
|
/**
|
|
|
|
* Initializes the receiver with the provided
|
|
|
|
* nil terminated list of qualifiers. This method calls
|
|
|
|
* [EOAndQualifier-initWithQualifierArray:].
|
|
|
|
*/
|
2002-11-15 22:57:05 +00:00
|
|
|
- (id) initWithQualifiers: (EOQualifier *)qualifiers, ...
|
|
|
|
{
|
2003-05-02 17:00:23 +00:00
|
|
|
NSArray *qualArray;
|
2002-11-15 22:57:05 +00:00
|
|
|
|
2003-05-02 17:00:23 +00:00
|
|
|
GS_USEIDLIST(qualifiers, qualArray
|
|
|
|
= AUTORELEASE([[NSArray alloc] initWithObjects: __objects
|
|
|
|
count: __count]));
|
2002-11-15 22:57:05 +00:00
|
|
|
|
|
|
|
return [self initWithQualifierArray: qualArray];
|
|
|
|
}
|
|
|
|
|
2003-02-13 11:39:01 +00:00
|
|
|
/** <init />
|
|
|
|
* Initializes the receiver with the provided array of qualifiers.
|
|
|
|
*/
|
2002-11-15 22:57:05 +00:00
|
|
|
- (id) initWithQualifierArray: (NSArray *)array
|
|
|
|
{
|
|
|
|
if ((self = [self init]))
|
|
|
|
{
|
2003-02-13 11:39:01 +00:00
|
|
|
ASSIGNCOPY(_qualifiers, array);
|
2002-11-15 22:57:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)dealloc
|
|
|
|
{
|
|
|
|
DESTROY(_qualifiers);
|
|
|
|
|
|
|
|
[super dealloc];
|
|
|
|
}
|
|
|
|
|
2003-02-13 11:39:01 +00:00
|
|
|
/**
|
|
|
|
* Returns the recievers array of qualifiers.
|
|
|
|
*/
|
2002-11-15 22:57:05 +00:00
|
|
|
- (NSArray *)qualifiers
|
|
|
|
{
|
|
|
|
return _qualifiers;
|
|
|
|
}
|
|
|
|
|
2003-02-13 11:39:01 +00:00
|
|
|
/**
|
|
|
|
* EOQualifierEvaluation protocol
|
|
|
|
* Returns YES if all of the receivers qualifiers return YES to
|
|
|
|
* [EOQualifierEvaluation-evaluateWithObjects:] with object. This method
|
|
|
|
* returns NO as soon as the first qualifier retuns NO.
|
|
|
|
*/
|
2002-11-15 22:57:05 +00:00
|
|
|
- (BOOL)evaluateWithObject: (id)object
|
|
|
|
{
|
|
|
|
NSEnumerator *qualifiersEnum;
|
|
|
|
EOQualifier *qualifier;
|
|
|
|
|
|
|
|
qualifiersEnum = [_qualifiers objectEnumerator];
|
|
|
|
|
|
|
|
while ((qualifier = [qualifiersEnum nextObject]))
|
|
|
|
{
|
|
|
|
if ([qualifier evaluateWithObject: object] == NO)
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) qualifierMigratedFromEntity: (id)param0
|
|
|
|
relationshipPath: (id)param1
|
|
|
|
{
|
|
|
|
return [self notImplemented: _cmd]; //TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) _addBindingsToDictionary: (id)param0
|
|
|
|
{
|
|
|
|
[self notImplemented: _cmd]; //TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
- (EOQualifier *) qualifierWithBindings: (NSDictionary *)bindings
|
|
|
|
requiresAllVariables: (BOOL)requiresAllVariables
|
|
|
|
{
|
|
|
|
EOFLOGObjectLevelArgs(@"EOQualifier", @"bindings=%@", bindings);
|
|
|
|
|
|
|
|
if ([bindings count] > 0)
|
|
|
|
{
|
|
|
|
NSEmitTODO();
|
|
|
|
return [self notImplemented: _cmd]; //TODO
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithKeyValueUnarchiver: (id)param0
|
|
|
|
{
|
|
|
|
return [self notImplemented: _cmd]; //TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) encodeWithKeyValueArchiver: (id)param0
|
|
|
|
{
|
|
|
|
[self notImplemented: _cmd]; //TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) validateKeysWithRootClassDescription: (id)param0
|
|
|
|
{
|
|
|
|
return [self notImplemented: _cmd]; //TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) description
|
|
|
|
{
|
|
|
|
NSString *dscr;
|
|
|
|
|
|
|
|
dscr = [NSString stringWithFormat: @"<%s %p - qualifiers: %@>",
|
|
|
|
object_get_class_name(self),
|
|
|
|
(void*)self,
|
|
|
|
_qualifiers];
|
|
|
|
|
|
|
|
return dscr;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|