arq_restore/plist/RealNode.m
Stefan Reitshamer cbe20c007e Merged in many changes from Arq mainline development.
(Sorry for the lame commit comment).
2010-08-19 13:25:23 -04:00

48 lines
966 B
Objective-C

//
// RealNode.m
// Backup
//
// Created by Stefan Reitshamer on 4/13/09.
// Copyright 2009 PhotoMinds LLC. All rights reserved.
//
#import "PListNodeType.h"
#import "RealNode.h"
#import "SetNSError.h"
@implementation RealNode
- (id)initWithDouble:(double)theValue {
if (self = [super init]) {
value = theValue;
}
return self;
}
- (id)initWithString:(NSString *)theValue error:(NSError **)error {
if (self = [super init]) {
NSScanner *scanner = [NSScanner scannerWithString:theValue];
if (![scanner scanDouble:&value]) {
SETNSERROR(@"PListErrorDomain", -1, @"string does not contain a double: %@", theValue);
[self release];
self = nil;
}
}
return self;
}
- (double)doubleValue {
return value;
}
#pragma mark PListNode protocol
- (int)type {
return PLN_REAL;
}
#pragma mark NSObject protocol
- (NSString *)description {
return [NSString stringWithFormat:@"<RealNode 0x%x %f>", self, value];
}
@end