//
//  OANSNumberInteger.m
//  Flash
//
//  Created by Niko Matsakis on 26.07.07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "OANSNumberInteger.h"


@implementation OANSNumberInteger

+ (Class) transfomedValueClass {
    return [NSNumber class];
}

+ (BOOL) allowsReverseTransformation {
    return YES;
}

- (id)transformedValue:(id)value {
    return [value description];
}

- (id)reverseTransformedValue:(id)value {
    NSScanner *scanner = [NSScanner scannerWithString:value];
    int intValue;
    if ([scanner scanInt:&intValue]) {
        return [NSNumber numberWithInt:intValue];
    }
    return [NSNumber numberWithInt:0];
}

@end
