mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Correct formatting.
Use import instead of include. Add missing import. Correct encoding strings. Correct measurement conversion.
This commit is contained in:
parent
13f7446a32
commit
aae21568d4
13 changed files with 129 additions and 107 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2019-10-27 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Headers/Foundation/NSUnit.h,
|
||||
* Headers/Foundation/NSMeasurement.h,
|
||||
* Headers/Foundation/NSMeasurementFormatter.h,
|
||||
* Headers/Foundation/NSEnergyFormatter.h,
|
||||
* Headers/Foundation/NSLengthFormatter.h,
|
||||
* Headers/Foundation/NSMassFormatter.h,
|
||||
* Source/NSUnit.m,
|
||||
* Source/NSMeasurement.m,
|
||||
* Source/NSMeasurementFormatter.m,
|
||||
* Source/NSEnergyFormatter.m,
|
||||
* Source/NSLengthFormatter.m,
|
||||
* Source/NSMassFormatter.m,
|
||||
* Source/NSUnit.m: More cleanup on the measurement code.
|
||||
|
||||
2019-10-29 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* Source/GSStream.h,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Definition of class NSEnergyFormatter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: heron
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Tue Oct 8 13:30:10 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
@ -25,14 +25,14 @@
|
|||
#ifndef _NSEnergyFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSEnergyFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSFormatter.h>
|
||||
#import <Foundation/NSFormatter.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
@class NSNumberFormatter, NSString;
|
||||
|
||||
enum {
|
||||
|
|
|
@ -25,13 +25,14 @@
|
|||
#ifndef _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSLengthFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSFormatter.h>
|
||||
#import <Foundation/NSFormatter.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
enum {
|
||||
NSLengthFormatterUnitMillimeter = 8,
|
||||
NSLengthFormatterUnitCentimeter = 9,
|
||||
|
@ -70,7 +71,7 @@ typedef NSInteger NSLengthFormatterUnit;
|
|||
|
||||
- (NSString *) unitStringFromMeters: (double)numberInMeters usedUnit: (NSLengthFormatterUnit *)unit;
|
||||
|
||||
- (BOOL)getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error;
|
||||
- (BOOL) getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* Definition of class NSMassFormatter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: heron
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Mon Sep 30 15:58:21 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
@ -26,14 +26,14 @@
|
|||
#ifndef _NSMassFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSMassFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSFormatter.h>
|
||||
#import <Foundation/NSFormatter.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST)
|
||||
|
||||
enum {
|
||||
NSMassFormatterUnitGram = 11,
|
||||
NSMassFormatterUnitKilogram = 14,
|
||||
|
@ -69,7 +69,7 @@ typedef NSInteger NSMassFormatterUnit;
|
|||
|
||||
- (NSString *)unitStringFromKilograms: (double)numberInKilograms usedUnit: (NSMassFormatterUnit *)unitp;
|
||||
|
||||
- (BOOL)getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error;
|
||||
- (BOOL) getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@
|
|||
#ifndef _NSMeasurement_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSMeasurement_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSUnit.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* Definition of class NSMeasurementFormatter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By:Gregory John Casamento <greg.casamento@gmail.com>
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Mon Sep 30 15:58:21 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
@ -25,16 +25,15 @@
|
|||
#ifndef _NSMeasurementFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSMeasurementFormatter_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#import <Foundation/NSFormatter.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#include <Foundation/NSFormatter.h>
|
||||
|
||||
@class NSLocale, NSMeasurement, NSNumberFormatter, NSUnit;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
|
||||
|
||||
enum {
|
||||
NSMeasurementFormatterUnitOptionsProvidedUnit = (1UL << 0),
|
||||
|
|
|
@ -25,14 +25,14 @@
|
|||
#ifndef _NSUnit_h_GNUSTEP_BASE_INCLUDE
|
||||
#define _NSUnit_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_12, GS_API_LATEST)
|
||||
|
||||
// Unit converter
|
||||
@interface NSUnitConverter : NSObject
|
||||
- (double) baseUnitValueFromValue: (double)value;
|
||||
|
|
|
@ -22,17 +22,18 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSEnergyFormatter.h>
|
||||
#include <Foundation/NSMeasurement.h>
|
||||
#include <Foundation/NSMeasurementFormatter.h>
|
||||
#include <Foundation/NSUnit.h>
|
||||
#import "Foundation/NSEnergyFormatter.h"
|
||||
#import "Foundation/NSMeasurement.h"
|
||||
#import "Foundation/NSMeasurementFormatter.h"
|
||||
#import "Foundation/NSNumberFormatter.h"
|
||||
#import "Foundation/NSUnit.h"
|
||||
|
||||
@implementation NSEnergyFormatter
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
if (self != nil)
|
||||
{
|
||||
_numberFormatter = nil;
|
||||
_unitStyle = NSFormattingUnitStyleMedium;
|
||||
|
@ -70,13 +71,14 @@
|
|||
{
|
||||
_isForFoodEnergyUse = flag;
|
||||
}
|
||||
|
||||
- (NSString *) stringFromValue: (double)value unit: (NSEnergyFormatterUnit)unit
|
||||
{
|
||||
NSUnit *u = nil;
|
||||
NSMeasurement *m = nil;
|
||||
NSMeasurementFormatter *mf = nil;
|
||||
|
||||
switch(unit)
|
||||
switch (unit)
|
||||
{
|
||||
case NSEnergyFormatterUnitJoule:
|
||||
u = [NSUnitEnergy joules];
|
||||
|
@ -119,7 +121,7 @@
|
|||
return [self stringFromValue: numberInJoules unit: *unit];
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
- (BOOL) getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* Implementation of class NSLengthFormatter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: heron
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Tue Oct 8 13:30:33 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
@ -23,10 +23,11 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSLengthFormatter.h>
|
||||
#include <Foundation/NSUnit.h>
|
||||
#include <Foundation/NSMeasurement.h>
|
||||
#include <Foundation/NSMeasurementFormatter.h>
|
||||
#import "Foundation/NSLengthFormatter.h"
|
||||
#import "Foundation/NSMeasurement.h"
|
||||
#import "Foundation/NSMeasurementFormatter.h"
|
||||
#import "Foundation/NSNumberFormatter.h"
|
||||
#import "Foundation/NSUnit.h"
|
||||
|
||||
@implementation NSLengthFormatter
|
||||
|
||||
|
@ -139,7 +140,7 @@
|
|||
return [self stringFromValue: numberInMeters unit: *unit];
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
- (BOOL) getObjectValue: (id *)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* Implementation of class NSMassFormatter
|
||||
Copyright (C) 2019 Free Software Foundation, Inc.
|
||||
|
||||
By: heron
|
||||
By: Gregory John Casamento <greg.casamento@gmail.com>
|
||||
Date: Mon Sep 30 15:58:21 EDT 2019
|
||||
|
||||
This file is part of the GNUstep Library.
|
||||
|
@ -23,17 +23,18 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSMassFormatter.h>
|
||||
#include <Foundation/NSMeasurement.h>
|
||||
#include <Foundation/NSMeasurementFormatter.h>
|
||||
#include <Foundation/NSUnit.h>
|
||||
#import "Foundation/NSMassFormatter.h"
|
||||
#import "Foundation/NSMeasurement.h"
|
||||
#import "Foundation/NSMeasurementFormatter.h"
|
||||
#import "Foundation/NSNumberFormatter.h"
|
||||
#import "Foundation/NSUnit.h"
|
||||
|
||||
@implementation NSMassFormatter
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
if (self != nil)
|
||||
{
|
||||
_numberFormatter = nil;
|
||||
_unitStyle = NSFormattingUnitStyleMedium;
|
||||
|
@ -72,7 +73,7 @@
|
|||
_isForPersonMassUse = flag;
|
||||
}
|
||||
|
||||
- (NSString *)stringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
- (NSString *) stringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
{
|
||||
NSUnit *u = nil;
|
||||
NSMeasurement *m = nil;
|
||||
|
@ -108,26 +109,25 @@
|
|||
return [mf stringFromMeasurement: m];
|
||||
}
|
||||
|
||||
- (NSString *)stringFromKilograms: (double)numberInKilograms;
|
||||
- (NSString *) stringFromKilograms: (double)numberInKilograms;
|
||||
{
|
||||
return [self stringFromValue: numberInKilograms unit: NSMassFormatterUnitKilogram];
|
||||
}
|
||||
|
||||
- (NSString *)unitStringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
- (NSString *) unitStringFromValue: (double)value unit: (NSMassFormatterUnit)unit;
|
||||
{
|
||||
return [self stringFromValue: value unit: unit];
|
||||
}
|
||||
|
||||
- (NSString *)unitStringFromKilograms: (double)numberInKilograms usedUnit: (NSMassFormatterUnit *)unit
|
||||
- (NSString *) unitStringFromKilograms: (double)numberInKilograms usedUnit: (NSMassFormatterUnit *)unit
|
||||
{
|
||||
*unit = NSMassFormatterUnitKilogram;
|
||||
return [self stringFromValue: numberInKilograms unit: *unit];
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
- (BOOL) getObjectValue: (id*)obj forString: (NSString *)string errorDescription: (NSString **)error
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -22,19 +22,19 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSMeasurement.h>
|
||||
#include <Foundation/NSUnit.h>
|
||||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSArchiver.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
#import "Foundation/NSArchiver.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "Foundation/NSKeyedArchiver.h"
|
||||
#import "Foundation/NSMeasurement.h"
|
||||
#import "Foundation/NSUnit.h"
|
||||
|
||||
@implementation NSMeasurement
|
||||
// Creating Measurements
|
||||
- (instancetype)initWithDoubleValue: (double)doubleValue
|
||||
unit: (NSUnit *)unit
|
||||
- (instancetype) initWithDoubleValue: (double)doubleValue
|
||||
unit: (NSUnit *)unit
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
if (self != nil)
|
||||
{
|
||||
ASSIGNCOPY(_unit, unit);
|
||||
_doubleValue = doubleValue;
|
||||
|
@ -68,49 +68,44 @@
|
|||
|
||||
- (NSMeasurement *) measurementByConvertingToUnit: (NSUnit *)unit
|
||||
{
|
||||
NSMeasurement *result = nil;
|
||||
double val = 0.0;
|
||||
if([self canBeConvertedToUnit: unit])
|
||||
if ([self canBeConvertedToUnit: unit])
|
||||
{
|
||||
NSMeasurement *result = nil;
|
||||
double val = 0.0;
|
||||
|
||||
// Do conversion...
|
||||
NSUnitConverter *c = [(NSDimension *)unit converter];
|
||||
NSUnitConverter *c = [(NSDimension *)_unit converter];
|
||||
val = [c baseUnitValueFromValue: _doubleValue];
|
||||
c = [(NSDimension *)unit converter];
|
||||
val = [c valueFromBaseUnitValue: val];
|
||||
result = [[NSMeasurement alloc] initWithDoubleValue: val unit: unit];
|
||||
AUTORELEASE(result);
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"Cannot convert from %@ to %@", _unit, unit];
|
||||
}
|
||||
return result;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Operating
|
||||
- (NSMeasurement *) measurementByAddingMeasurement: (NSMeasurement *)measurement
|
||||
{
|
||||
NSMeasurement *newMeasurement = [measurement measurementByConvertingToUnit: _unit];
|
||||
NSMeasurement *result = nil;
|
||||
double v = 0.0;
|
||||
double v = _doubleValue + [newMeasurement doubleValue];
|
||||
NSMeasurement *result = [[NSMeasurement alloc] initWithDoubleValue: v unit: _unit];
|
||||
|
||||
v = _doubleValue + [newMeasurement doubleValue];
|
||||
result = [[NSMeasurement alloc] initWithDoubleValue: v unit: _unit];
|
||||
AUTORELEASE(result);
|
||||
|
||||
return result;
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
- (NSMeasurement *) measurementBySubtractingMeasurement: (NSMeasurement *)measurement
|
||||
{
|
||||
NSMeasurement *newMeasurement = [measurement measurementByConvertingToUnit: _unit];
|
||||
NSMeasurement *result = nil;
|
||||
double v = 0.0;
|
||||
double v = _doubleValue - [newMeasurement doubleValue];
|
||||
NSMeasurement *result = [[NSMeasurement alloc] initWithDoubleValue: v unit: _unit];
|
||||
|
||||
v = _doubleValue - [newMeasurement doubleValue];
|
||||
result = [[NSMeasurement alloc] initWithDoubleValue: v unit: _unit];
|
||||
AUTORELEASE(result);
|
||||
|
||||
return result;
|
||||
return AUTORELEASE(result);
|
||||
}
|
||||
|
||||
// NSCopying
|
||||
|
@ -123,11 +118,10 @@
|
|||
// NSCoding
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
// TODO: Verify that this is the correct encoding...
|
||||
[coder encodeObject: _unit forKey: @"unit"];
|
||||
[coder encodeDouble: _doubleValue forKey: @"doubleValue"];
|
||||
[coder encodeObject: _unit forKey: @"NS.unit"];
|
||||
[coder encodeDouble: _doubleValue forKey: @"NS.value"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -138,12 +132,12 @@
|
|||
|
||||
- (id) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if((self = [super init]) != nil)
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
_unit = [coder decodeObjectForKey: @"unit"];
|
||||
_doubleValue = [coder decodeDoubleForKey: @"doubleValue"];
|
||||
_unit = [coder decodeObjectForKey: @"NS.unit"];
|
||||
_doubleValue = [coder decodeDoubleForKey: @"NS.value"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -22,18 +22,18 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSMeasurementFormatter.h>
|
||||
#include <Foundation/NSLocale.h>
|
||||
#include <Foundation/NSMeasurement.h>
|
||||
#include <Foundation/NSNumberFormatter.h>
|
||||
#include <Foundation/NSUnit.h>
|
||||
#import "Foundation/NSLocale.h"
|
||||
#import "Foundation/NSMeasurement.h"
|
||||
#import "Foundation/NSMeasurementFormatter.h"
|
||||
#import "Foundation/NSNumberFormatter.h"
|
||||
#import "Foundation/NSUnit.h"
|
||||
|
||||
@implementation NSMeasurementFormatter
|
||||
|
||||
- (instancetype) init
|
||||
{
|
||||
self = [super init];
|
||||
if(self != nil)
|
||||
if (self != nil)
|
||||
{
|
||||
_unitOptions = NSMeasurementFormatterUnitOptionsProvidedUnit;
|
||||
_unitStyle = NSFormattingUnitStyleMedium;
|
||||
|
@ -88,14 +88,14 @@
|
|||
ASSIGNCOPY(_numberFormatter, numberFormatter);
|
||||
}
|
||||
|
||||
- (NSString *)stringFromMeasurement: (NSMeasurement *)measurement
|
||||
- (NSString *) stringFromMeasurement: (NSMeasurement *)measurement
|
||||
{
|
||||
NSString *result = nil;
|
||||
NSNumber *num = [NSNumber numberWithDouble: [measurement doubleValue]];
|
||||
NSUnit *u = [measurement unit];
|
||||
|
||||
result = [_numberFormatter stringForObjectValue: num];
|
||||
switch(_unitStyle)
|
||||
switch (_unitStyle)
|
||||
{
|
||||
case NSFormattingUnitStyleShort:
|
||||
case NSFormattingUnitStyleMedium:
|
||||
|
@ -107,24 +107,34 @@
|
|||
return result;
|
||||
}
|
||||
|
||||
- (NSString *)stringFromUnit: (NSUnit *)unit
|
||||
- (NSString *) stringFromUnit: (NSUnit *)unit
|
||||
{
|
||||
return [unit symbol];
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue: (id)obj
|
||||
- (NSString *) stringForObjectValue: (id)obj
|
||||
{
|
||||
NSString *result = nil;
|
||||
if([obj isKindOfClass: [NSMeasurement class]])
|
||||
if ([obj isKindOfClass: [NSMeasurement class]])
|
||||
{
|
||||
result = [self stringFromMeasurement: obj];
|
||||
}
|
||||
else if([obj isKindOfClass: [NSUnit class]])
|
||||
else if ([obj isKindOfClass: [NSUnit class]])
|
||||
{
|
||||
result = [self stringFromUnit: obj];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)decoder
|
||||
{
|
||||
self = [super initWithCoder: decoder];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)encoder
|
||||
{
|
||||
[super encodeWithCoder: encoder];
|
||||
}
|
||||
@end
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@
|
|||
Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSUnit.h>
|
||||
#include <Foundation/NSArchiver.h>
|
||||
#include <Foundation/NSKeyedArchiver.h>
|
||||
#import "Foundation/NSArchiver.h"
|
||||
#import "Foundation/NSKeyedArchiver.h"
|
||||
#import "Foundation/NSUnit.h"
|
||||
|
||||
// Private methods...
|
||||
@interface NSDimension (Private)
|
||||
|
@ -69,8 +69,8 @@
|
|||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
_coefficient = [coder decodeDoubleForKey: @"coefficient"];
|
||||
_constant = [coder decodeDoubleForKey: @"constant"];
|
||||
_coefficient = [coder decodeDoubleForKey: @"NS.coefficient"];
|
||||
_constant = [coder decodeDoubleForKey: @"NS.constant"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -84,8 +84,8 @@
|
|||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeDouble: _coefficient forKey: @"coefficient"];
|
||||
[coder encodeDouble: _constant forKey: @"constant"];
|
||||
[coder encodeDouble: _coefficient forKey: @"NS.coefficient"];
|
||||
[coder encodeDouble: _constant forKey: @"NS.constant"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -136,7 +136,7 @@
|
|||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
_symbol = [coder decodeObjectForKey: @"symbol"];
|
||||
_symbol = [coder decodeObjectForKey: @"NS.symbol"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -149,7 +149,7 @@
|
|||
{
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: _symbol forKey: @"symbol"];
|
||||
[coder encodeObject: _symbol forKey: @"NS.symbol"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -209,7 +209,7 @@
|
|||
self = [super initWithCoder: coder];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
_converter = [coder decodeObjectForKey: @"converter"];
|
||||
_converter = [coder decodeObjectForKey: @"NS.converter"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -223,7 +223,7 @@
|
|||
[super encodeWithCoder: coder];
|
||||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: _converter forKey: @"converter"];
|
||||
[coder encodeObject: _converter forKey: @"NS.converter"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue