• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 //  ACNumber.h
3 //  ST4
4 //
5 //  Created by Alan Condit on 3/19/12.
6 //  Copyright 2012 Alan Condit. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 
11 
12 @interface ACNumber : NSObject {
13 
14     union {
15         BOOL b;
16         char c;
17         double d;
18         NSInteger i;
19     } u;
20 
21     BOOL fBOOL   :  1;
22     BOOL fChar   :  1;
23     BOOL fDouble :  1;
24     BOOL fNSInt  :  1;
25 }
26 
27 + (ACNumber *)numberWithBool:(BOOL)aBool;
28 + (ACNumber *)numberWithChar:(char)aChar;
29 + (ACNumber *)numberWithDouble:(double)aDouble;
30 + (ACNumber *)numberWithInt:(NSInteger)anInt;
31 + (ACNumber *)numberWithInteger:(NSInteger)anInt;
32 
33 - (ACNumber *)initWithBool:(BOOL)aBool;
34 - (ACNumber *)initWithChar:(char)aChar;
35 - (ACNumber *)initWithDouble:(double)aDouble;
36 - (ACNumber *)initWithInteger:(NSInteger)anInt;
37 
38 - (BOOL)boolValue;
39 - (char)charValue;
40 - (double)doubleValue;
41 - (NSInteger)intValue;
42 - (NSInteger)integerValue;
43 - (NSInteger)inc;
44 - (NSInteger)add:(NSInteger)anInt;
45 - (NSString *)description;
46 
47 @end
48