This is DoubleObject.m in view mode; [Download] [Up]
/*
* Copyright (C) 1993 Robert Davis
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of Version 2, or any later version, of
* the GNU General Public License as published by the Free Software
* Foundation.
*/
static char RCSId[]="$Id: DoubleObject.m,v 1.1 1993/05/04 16:21:43 davis Exp $";
#import <stdio.h> /* sprintf() */
#import "DoubleObject.h"
#define DIGITS_ACCURACY 10
@implementation DoubleObject
/* Overrides SubObjects initFromString: */
- initFromString:(const char *)aString
{
return nil;
}
- initFromDouble:(double)aDouble
{
[super init];
[self setDoubleValue:aDouble];
return self;
}
- setDoubleValue:(double)aDouble
{
char string[1000];
doubleValue = aDouble;
sprintf (string, "%.*f", DIGITS_ACCURACY, doubleValue);
[super setStringValue: string];
return self;
}
- (double)doubleValue
{
return doubleValue;
}
- setStringValue:(const char *)aString
{
return self;
}
// Shuts up the compiler about unused RCSId
- (const char *) rcsid
{
return RCSId;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.