]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/nfrs.h
2 ******************************************************************************
3 * Copyright (C) 1997-2004, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ******************************************************************************
8 * tab size: 8 (not used)
11 * Modification history
13 * 10/11/2001 Doug Ported from ICU4J
19 #include "unicode/uobject.h"
20 #include "unicode/rbnf.h"
24 #include "unicode/utypes.h"
25 #include "unicode/umisc.h"
31 class NFRuleSet
: public UMemory
{
33 NFRuleSet(UnicodeString
* descriptions
, int32_t index
, UErrorCode
& status
);
34 void parseRules(UnicodeString
& rules
, const RuleBasedNumberFormat
* owner
, UErrorCode
& status
);
35 void makeIntoFractionRuleSet() { fIsFractionRuleSet
= TRUE
; }
39 UBool
operator==(const NFRuleSet
& rhs
) const;
40 UBool
operator!=(const NFRuleSet
& rhs
) const { return !operator==(rhs
); }
42 UBool
isPublic() const { return fIsPublic
; }
43 UBool
isFractionRuleSet() const { return fIsFractionRuleSet
; }
45 void getName(UnicodeString
& result
) const { result
.setTo(name
); }
46 UBool
isNamed(const UnicodeString
& _name
) const { return this->name
== _name
; }
48 void format(int64_t number
, UnicodeString
& toAppendTo
, int32_t pos
) const;
49 void format(double number
, UnicodeString
& toAppendTo
, int32_t pos
) const;
51 UBool
parse(const UnicodeString
& text
, ParsePosition
& pos
, double upperBound
, Formattable
& result
) const;
53 void appendRules(UnicodeString
& result
) const; // toString
56 NFRule
* findNormalRule(int64_t number
) const;
57 NFRule
* findDoubleRule(double number
) const;
58 NFRule
* findFractionRuleSetRule(double number
) const;
63 NFRule
*negativeNumberRule
;
64 NFRule
*fractionRules
[3];
65 UBool fIsFractionRuleSet
;
67 int32_t fRecursionCount
;
69 NFRuleSet(const NFRuleSet
&other
); // forbid copying of this class
70 NFRuleSet
&operator=(const NFRuleSet
&other
); // forbid copying of this class
73 // utilities from old llong.h
74 // convert mantissa portion of double to int64
75 int64_t util64_fromDouble(double d
);
77 // raise radix to the power exponent, only non-negative exponents
78 int64_t util64_pow(int32_t radix
, uint32_t exponent
);
80 // convert n to digit string in buffer, return length of string
81 uint32_t util64_tou(int64_t n
, UChar
* buffer
, uint32_t buflen
, uint32_t radix
= 10, UBool raw
= FALSE
);
82 int64_t util64_utoi(const UChar
* str
, uint32_t radix
= 10);
85 uint32_t util64_toa(int64_t n
, char* buffer
, uint32_t buflen
, uint32_t radix
= 10, UBool raw
= FALSE
);
86 int64_t util64_atoi(const char* str
, uint32_t radix
);