mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-02-22 10:51:04 +00:00
([EOAndQualifier +qualifierWithQualifiers:]), ([EOAndQualifier -initWithQualifiers:]): Synchronize implementation. ([EOAndQualifier -initWithQualifierArray:]): Change ASSIGN to ASSIGNCOPY when setting qualifier array (insuring immutability). ([EOAndQualifier -copyWithZone:]): remove (use implementation from superclass). * EOControl/EOKeyComparisonQualifier.m: Added documentation. ([EOKeyComparisonQualifier +qualifierWithLeftKey:operatorSelector:rightKey:]): Use AUTORELEASE() instead of -autorelease. ([EOKeyComparisonQualifier -initWithLeftKey:operatorSelector:rightKey:]): Use ASSIGNCOPY instead of ASSIGN to insure immutable keys. Added comment about possible selector assertion. ([EOKeyComparisonQualifier -copyWithZone:]): remove (use implementation from superclass). ([EOKeyComparisonQualifier -evaluateWithObject:]): Try to call the receivers selector before attempting to fallback on other mechanisms to evaluate the object. Adjusted local variable names and fixed fallback Equal, NotEqual and Contains comparisons. ([EOKeyComparisonQualifier -description]): Fall back to NSStringFromSelector() if +stringForOperatorSelector returns nil. * EOControl/EOKeyValueQualifier.m: Added documentation ([EOKeyValueQualifier +qualifierWithKey:operatorSelector:value:]): Use AUTORELEASE() instead of -autorelease. ([EOKeyValueQualifier -initWithKey:operatorSelector:value:]): Use ASSIGNCOPY instead of ASSIGN to insure immutable key. Added comment about possible selector assertion. ([EOKeyValueQualifier -copyWithZone:]): remove (use implementation from superclass). ([EOKeyValueQualifier -evaluateWithObject:]): Try to call the receivers selector before attempting to fallback on other mechanisms to evaluate the object. Adjusted local variable names and fixed fallback Equal, NotEqual and Contains comparisons. ([EOKeyValueQualifier -description]): Fall back to NSStringFromSelector() if +stringForOperatorSelector returns nil. * EOControl/EONotQualifier.m: Added documentation. ([EONotQualifier -copyWithZone:]): remove (use implementation from superclass). ([EONotQualifier -evaluateWithObject:]): Implemented. * EOControl/EOOrQualifier.m: Added documentation. ([EOOrQualifier +qualifierWithQualifiers:]), ([EOORQualifier -initWithQualifiers:]): Synchronize implementation. ([EOOrQualifier -copyWithZone:]): remove (use implementation from superclass). ([EOOrQualifier -evaluateWithObject:]): Corrected implementation. * EOControl/EOQualifier.m: Added documentation ([EOQualifier +initialize]), (getKey()): Replace autorelease with AUTORELEASE(). ([EOQualifier -copyWithZone:]): RETAIN() instead of NSCopyObject(). ([EOQualifier +variableWithKey:]): Corrected implementation. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@15952 72102866-910b-0410-8b05-ffd578937521
209 lines
4.8 KiB
Objective-C
209 lines
4.8 KiB
Objective-C
/**
|
|
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>
|
|
**/
|
|
|
|
#include "config.h"
|
|
|
|
RCS_ID("$Id$")
|
|
|
|
#import <Foundation/NSDictionary.h>
|
|
#import <Foundation/NSSet.h>
|
|
#import <Foundation/NSUtilities.h>
|
|
#import <Foundation/NSDebug.h>
|
|
|
|
#import <EOControl/EOQualifier.h>
|
|
#import <EOControl/EODebug.h>
|
|
|
|
|
|
@implementation EOAndQualifier
|
|
|
|
/**
|
|
* Returns an autoreleased EOAndQualifier consisting of the provided array of
|
|
* qualifiers. This method calls [EOAndQualifier-initWithQualifierArray:].
|
|
*/
|
|
+ (EOQualifier *) qualifierWithQualifierArray: (NSArray *)array
|
|
{
|
|
return AUTORELEASE([[self alloc] initWithQualifierArray: array]);
|
|
}
|
|
|
|
/**
|
|
* Returns an autoreleased EOAndQualifier consisting of the provided
|
|
* nil terminated list of qualifiers. This method calls
|
|
* [EOAndQualifier-initWithQualifierArray:].
|
|
*/
|
|
+ (EOQualifier *) qualifierWithQualifiers: (EOQualifier *)qualifiers, ...
|
|
{
|
|
NSMutableArray *qualArray = [NSMutableArray array];
|
|
EOQualifier *tmpId;
|
|
va_list ap;
|
|
|
|
va_start(ap, qualifiers);
|
|
|
|
for (tmpId = qualifiers; tmpId != nil; tmpId = va_arg(ap, id))
|
|
{
|
|
[qualArray addObject: tmpId];
|
|
}
|
|
|
|
va_end(ap);
|
|
|
|
return AUTORELEASE([[self alloc] initWithQualifierArray: qualArray]);
|
|
}
|
|
|
|
/**
|
|
* Initializes the receiver with the provided
|
|
* nil terminated list of qualifiers. This method calls
|
|
* [EOAndQualifier-initWithQualifierArray:].
|
|
*/
|
|
- (id) initWithQualifiers: (EOQualifier *)qualifiers, ...
|
|
{
|
|
NSMutableArray *qualArray = [NSMutableArray array];
|
|
EOQualifier *tmpId;
|
|
va_list ap;
|
|
|
|
va_start(ap, qualifiers);
|
|
|
|
for (tmpId = qualifiers; tmpId != nil; tmpId = va_arg(ap, id))
|
|
{
|
|
[qualArray addObject: tmpId];
|
|
}
|
|
|
|
va_end(ap);
|
|
|
|
return [self initWithQualifierArray: qualArray];
|
|
}
|
|
|
|
/** <init />
|
|
* Initializes the receiver with the provided array of qualifiers.
|
|
*/
|
|
- (id) initWithQualifierArray: (NSArray *)array
|
|
{
|
|
if ((self = [self init]))
|
|
{
|
|
ASSIGNCOPY(_qualifiers, array);
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (void)dealloc
|
|
{
|
|
DESTROY(_qualifiers);
|
|
|
|
[super dealloc];
|
|
}
|
|
|
|
/**
|
|
* Returns the recievers array of qualifiers.
|
|
*/
|
|
- (NSArray *)qualifiers
|
|
{
|
|
return _qualifiers;
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
- (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
|