mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Raise NSUnknownKeyException
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/branches/freeze-1_6_0@16021 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
853114cb50
commit
94e2176828
3 changed files with 30 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-02-19 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/NSKeyValueCoding.m ([NSObject -handleQueryWithUnboundKey:]):
|
||||
Raise NSUnknownKeyException.
|
||||
([NSObject -handleTakeValue:forUnboundKey:]): Idem.
|
||||
|
||||
2003-02-18 Adam Fedor <fedor@gnu.org>
|
||||
|
||||
* Source/GSFFIInvocation.m (GSFFIInvocationCallback): Cast
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
|
||||
GS_EXPORT NSString* const NSUnknownKeyException;
|
||||
|
||||
@interface NSObject (NSKeyValueCoding)
|
||||
|
||||
+ (BOOL) accessInstanceVariablesDirectly;
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include <Foundation/NSKeyValueCoding.h>
|
||||
#include <Foundation/NSNull.h>
|
||||
|
||||
/** An exception for an unknown key */
|
||||
NSString* const NSUnknownKeyException = @"NSUnknownKeyException";
|
||||
|
||||
/**
|
||||
* This describes an informal protocol for key-value coding.
|
||||
|
@ -58,19 +60,31 @@
|
|||
|
||||
- (id) handleQueryWithUnboundKey: (NSString*)aKey
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%@ -- %@ 0x%x: Unable to find value for key \"%@\"",
|
||||
NSStringFromSelector(_cmd), NSStringFromClass([self class]), self, aKey];
|
||||
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
self,
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
aKey,
|
||||
@"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
NSException *exp = [NSException exceptionWithName: NSUnknownKeyException
|
||||
reason: @"Unable to find value for key"
|
||||
userInfo: dict];
|
||||
[exp raise];
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"%@ -- %@ 0x%x: Unable set value \"%@\" for key \"%@\"",
|
||||
NSStringFromSelector(_cmd), NSStringFromClass([self class]),
|
||||
self, anObject, aKey];
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
anObject,
|
||||
@"NSTargetObjectUserInfoKey",
|
||||
aKey,
|
||||
@"NSUnknownUserInfoKey",
|
||||
nil];
|
||||
NSException *exp = [NSException exceptionWithName: NSUnknownKeyException
|
||||
reason: @"Unable to set value for key"
|
||||
userInfo: dict];
|
||||
[exp raise];
|
||||
}
|
||||
|
||||
- (id) storedValueForKey: (NSString*)aKey
|
||||
|
|
Loading…
Reference in a new issue