4
Copyright (C) 2001, MDlink online service center GmbH, Helge Hess
7
Author: Helge Hess <helge.hess@mdlink.de>
9
This file is part of libFoundation.
11
Permission to use, copy, modify, and distribute this software and its
12
documentation for any purpose and without fee is hereby granted, provided
13
that the above copyright notice appear in all copies and that both that
14
copyright notice and this permission notice appear in supporting
17
We disclaim all warranties with regard to this software, including all
18
implied warranties of merchantability and fitness, in no event shall
19
we be liable for any special, indirect or consequential damages or any
20
damages whatsoever resulting from loss of use, data or profits, whether in
21
an action of contract, negligence or other tortious action, arising out of
22
or in connection with the use or performance of this software.
25
#ifndef __NSDecimalNumber_h__
26
#define __NSDecimalNumber_h__
28
#include <Foundation/NSValue.h>
29
#include <Foundation/NSDecimal.h>
31
@class NSDecimalNumber, NSString, NSDictionary;
33
@protocol NSDecimalNumberBehaviors
35
- (NSDecimalNumber *)exceptionDuringOperation:(SEL)method
36
error:(NSCalculationError)_error
37
leftOperand:(NSDecimalNumber *)_lhs
38
rightOperand:(NSDecimalNumber *)_rhs;
40
- (NSRoundingMode)roundingMode;
46
@interface NSDecimalNumber : NSNumber
51
+ (void)setDefaultBehavior:(id<NSDecimalNumberBehaviors>)_beh;
52
+ (id<NSDecimalNumberBehaviors>)defaultBehavior;
54
+ (NSDecimalNumber *)zero;
55
+ (NSDecimalNumber *)one;
56
+ (NSDecimalNumber *)notANumber;
57
+ (NSDecimalNumber *)maximumDecimalNumber;
58
+ (NSDecimalNumber *)minimumDecimalNumber;
60
+ (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)_num;
61
+ (NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long)_mantissa
63
isNegative:(BOOL)_flag;
65
+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)_s;
66
+ (NSDecimalNumber *)decimalNumberWithString:(NSString *)_s
67
locale:(NSDictionary *)_locale;
69
- (id)initWithDecimal:(NSDecimal)_num;
70
- (id)initWithMantissa:(unsigned long long)_mantissa
72
isNegative:(BOOL)_flag;
73
- (id)initWithString:(NSString *)_s;
74
- (id)initWithString:(NSString *)_s locale:(NSDictionary *)_locale;
78
- (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)_num;
79
- (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)_num;
80
- (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)_num;
81
- (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)_num;
83
- (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)_num
84
withBehavior:(id<NSDecimalNumberBehaviors>)_beh;
85
- (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)_num
86
withBehavior:(id<NSDecimalNumberBehaviors>)_beh;
87
- (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)_num
88
withBehavior:(id<NSDecimalNumberBehaviors>)_beh;
89
- (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)_num
90
withBehavior:(id<NSDecimalNumberBehaviors>)_beh;
94
- (NSDecimal)decimalValue;
95
- (double)doubleValue;
99
- (NSComparisonResult)compare:(NSNumber *)_num;
103
- (NSString *)descriptionWithLocale:(NSDictionary *)_locale;
107
@interface NSDecimalNumberHandler : NSObject < NSDecimalNumberBehaviors >
110
#endif /* __NSDecimalNumber_h__ */