mirror of
https://github.com/gnustep/libs-gdl2.git
synced 2025-04-22 12:55:44 +00:00
EOAccess/EOEntity.m (initWithPropertyList:owner:): Pass format along
as is. * EOControl/EOQualifier.m (getKey): Add some exceptions for invalid qualifier formats, and parse binding variables. (bindingKeys): Return the binding variable keys, not the qualifier keys with binding variable values. (EOQualifierVariable -description): Implement. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@26383 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d03b3e0598
commit
6c47a5bb17
2 changed files with 62 additions and 9 deletions
|
@ -206,8 +206,10 @@ NSString *EONextPrimaryKeyProcedureOperation = @"EONextPrimaryKeyProcedureOperat
|
|||
|
||||
if (tmpString)
|
||||
{
|
||||
/* FIXME use qualifierWithQualifierFormat:arguments maybe so
|
||||
we don't smash the stack */
|
||||
EOQualifier *restrictingQualifier
|
||||
= [EOQualifier qualifierWithQualifierFormat: @"%@", tmpString];
|
||||
= [EOQualifier qualifierWithQualifierFormat: tmpString];
|
||||
|
||||
[self setRestrictingQualifier: restrictingQualifier];
|
||||
}
|
||||
|
|
|
@ -223,6 +223,8 @@ getKey(const unichar **cFormat,
|
|||
unichar quoteChar;
|
||||
BOOL quoted = NO;
|
||||
BOOL literalNumber = NO;
|
||||
BOOL isQualVar = NO;
|
||||
BOOL isFormat = NO;
|
||||
|
||||
while (**s && spaceCIM(spaceSet, cimSEL, **s))
|
||||
(*s)++;
|
||||
|
@ -303,6 +305,11 @@ getKey(const unichar **cFormat,
|
|||
|
||||
int argInt;
|
||||
|
||||
/* TODO userInfo would be nice */
|
||||
if (isQualVar)
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"error parsing qualifier format"];
|
||||
|
||||
if (isKeyValue)
|
||||
{
|
||||
*isKeyValue = YES;
|
||||
|
@ -420,10 +427,16 @@ getKey(const unichar **cFormat,
|
|||
break;
|
||||
|
||||
case '%':
|
||||
*cFormat = *s + 2;
|
||||
(*s)++;
|
||||
[key appendString: [NSString stringWithCharacters: *cFormat
|
||||
{
|
||||
/* TODO userInfo would be nice */
|
||||
if ((*s - *cFormat) <= 2)
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"error parsing qualifier format"];
|
||||
*cFormat = *s + 2;
|
||||
(*s)++;
|
||||
[key appendString: [NSString stringWithCharacters: *cFormat
|
||||
length: *s - *cFormat]];
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -432,26 +445,59 @@ getKey(const unichar **cFormat,
|
|||
= @"%@ -- %@: unrecognized character (%@) in the conversion specification";
|
||||
NSString *specChar
|
||||
= [NSString stringWithCharacters: (*s + 1) length: 1];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: fmt, @"EOQualifier",
|
||||
@"qualifierParser", specChar];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (**s == '$')
|
||||
{
|
||||
/* TODO userInfo would be nice */
|
||||
if (isFormat)
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"error parsing qualifier format"];
|
||||
if (isKeyValue)
|
||||
{
|
||||
*isKeyValue = YES;
|
||||
isQualVar = YES;
|
||||
}
|
||||
}
|
||||
|
||||
(*s)++;
|
||||
}
|
||||
|
||||
if (*cFormat != *s)
|
||||
{
|
||||
NSString *str = [NSString stringWithCharacters: *cFormat
|
||||
length: *s - *cFormat];
|
||||
unsigned int length = *s - *cFormat;
|
||||
const unichar *c = *cFormat;
|
||||
NSString *str;
|
||||
|
||||
if (isKeyValue && c[0] == '$')
|
||||
{
|
||||
c++;
|
||||
length--;
|
||||
}
|
||||
|
||||
str = [NSString stringWithCharacters: c
|
||||
length: length];
|
||||
[key appendString: str];
|
||||
}
|
||||
}
|
||||
|
||||
if (isKeyValue)
|
||||
if (classString && (!(quoted || literalNumber)))
|
||||
{
|
||||
[NSException raise:NSInvalidArgumentException
|
||||
format:@"expected string literal after cast to class"];
|
||||
}
|
||||
|
||||
/* not sure about this !isQualVar */
|
||||
if (isQualVar)
|
||||
{
|
||||
key = (id)[[EOQualifierVariable alloc] initWithKey:key];
|
||||
}
|
||||
else if (isKeyValue)
|
||||
{
|
||||
*isKeyValue = (quoted || literalNumber);
|
||||
|
||||
|
@ -936,7 +982,7 @@ static Class whichQualifier(const unichar **cFormat, const unichar **s)
|
|||
{
|
||||
NSMutableDictionary* bindings = (id)[NSMutableDictionary dictionary];
|
||||
[self _addBindingsToDictionary:bindings];
|
||||
return [bindings allKeys];
|
||||
return [bindings allValues];
|
||||
}
|
||||
|
||||
//NO
|
||||
|
@ -1068,6 +1114,11 @@ static Class whichQualifier(const unichar **cFormat, const unichar **s)
|
|||
[archiver encodeObject: _key forKey: @"_key"];
|
||||
}
|
||||
|
||||
- (NSString *) description
|
||||
{
|
||||
return _key;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue