Implement coding/decoding

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23833 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-10-10 04:43:35 +00:00
parent d6cbf6dbf4
commit 9819f3e344
2 changed files with 32 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2006-10-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDecimalNumber.m: Implement coding/decoding
2006-10-09 Nicola Pero <nicola.pero@meta-innovation.com>
* GNUmakefile: Do not include GNUmakefile.local.

View file

@ -29,6 +29,8 @@
#include "Foundation/NSException.h"
#include "Foundation/NSDecimal.h"
#include "Foundation/NSDecimalNumber.h"
#include "Foundation/NSCoder.h"
#include "Foundation/NSPortCoder.h"
#include "GSPrivate.h"
// shared default behavior for NSDecimalNumber class
@ -663,6 +665,32 @@ static NSDecimalNumber *one;
return [[isa defaultBehavior] scale];
}
- (Class) classForCoder
{
return [NSDecimalNumber class];
}
- (id) replacementObjectForPortCoder: (NSPortCoder*)aCoder
{
if ([aCoder isByref] == NO)
return self;
return [super replacementObjectForPortCoder: aCoder];
}
- (void) encodeWithCoder: (NSCoder*)coder
{
NSString *s = [self descriptionWithLocale: nil];
[coder encodeObject: s];
}
- (id) initWithCoder: (NSCoder*)coder
{
NSString *s = [coder decodeObject];
return [self initWithString: s locale: nil];
}
@end
@implementation NSNumber (NSDecimalNumber)