Move implementation to correct category and fixup variable.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@25620 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Ayers 2007-11-27 21:27:48 +00:00
parent f03e51cce5
commit 389f6089d8

View file

@ -713,50 +713,6 @@ fromInsertionInEditingContext: (EOEditingContext *)editingContext
}
/**
* This method is called to validate and potentially coerce
* VALUE for the receivers key path. This method also assigns
* the value if it is different from the current value.
* This method will raise an EOValidationException
* if validateValue:forKey: returns an exception.
* This method returns new value.
**/
- (id)validateTakeValue:(id)value forKeyPath:(NSString *)path
{
id val = value;
id obj = self;
NSString *lastKey = path;
NSException *e;
/* AYERS: This needs to be verified...
normally we would travers the key path so that each
object has a chance to override this method the
same way we allow this for take value for key.
But for now lets assume that we can take this shortcut.
*/
NSRange r = [path rangeOfString: @"."
options: NSBackwardsSearch];
if (r.length)
{
NSString *keyPath = [aKey substringToIndex: r.location];
lastKey = [aKey substringFromIndex: NSMaxRange(r)];
obj = [self valueForKey: keyPath];
}
e = [obj validateValue:&val forKey:lastKey];
if (e)
{
[e raise];
}
else
{
[obj takeValue:val forKey: lastKey];
}
return val;
}
@end
@implementation EOClassDescription (Deprecated)
@ -1029,6 +985,50 @@ fromInsertionInEditingContext: (EOEditingContext *)editingContext
return exception;
}
/**
* This method is called to validate and potentially coerce
* VALUE for the receivers key path. This method also assigns
* the value if it is different from the current value.
* This method will raise an EOValidationException
* if validateValue:forKey: returns an exception.
* This method returns new value.
**/
- (id)validateTakeValue:(id)value forKeyPath:(NSString *)path
{
id val = value;
id obj = self;
NSString *lastKey = path;
NSException *e;
/* AYERS: This needs to be verified...
normally we would travers the key path so that each
object has a chance to override this method the
same way we allow this for take value for key.
But for now lets assume that we can take this shortcut.
*/
NSRange r = [path rangeOfString: @"."
options: NSBackwardsSearch];
if (r.length)
{
NSString *keyPath = [path substringToIndex: r.location];
lastKey = [path substringFromIndex: NSMaxRange(r)];
obj = [self valueForKey: keyPath];
}
e = [obj validateValue:&val forKey:lastKey];
if (e)
{
[e raise];
}
else
{
[obj takeValue:val forKey: lastKey];
}
return val;
}
- (NSException *)validateForSave
{
NSMutableArray *expArray = nil;