mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-27 10:40:50 +00:00
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:
parent
d6cbf6dbf4
commit
9819f3e344
2 changed files with 32 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue