|
|
|
|
|
|
|
|
Modules Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members Related Pages
acdk::lang::Number Class Reference#include <Number.h>
Inheritance diagram for acdk::lang::Number:
List of all members.
Detailed Description
This class provides some extended number parsing routines which also supports the extended unicode code character set and localization.
API: Java + ACDK
- Author:
- Roger Rene Kommer
- Version:
- Revision
- 1.20
- Date:
- Date
- 2005/04/09 19:26:48
|
Public Member Functions |
| | Number () |
| virtual byte | byteValue ()=0 |
| virtual short | shortValue ()=0 |
| virtual int | intValue ()=0 |
| virtual jlong | longValue ()=0 |
| virtual float | floatValue ()=0 |
| virtual double | doubleValue ()=0 |
| virtual int | hashCode () |
| virtual dmi::ScriptVar | toScriptVar () |
| template<class T> template_static T | toBigEndian (T t) |
| | group to convert plattform pendig bit order to or from BigEndian which will be used in Serialization and network
|
| template<class T> template_static T | fromBigEndian (T t) |
| template<class T> template_static T | fromLittleEndian (T t) |
| template<class T> template_static T | toLittleEndian (T t) |
| template<class T> template_static T | swapBits (T t) |
| template<class T> template_static int | getBitCountOf (T) |
| template<class T> template_static int | bitCount (T val) |
| template<class T> template_static T | rotateLeft (T val, int count) |
| template<class T> template_static T | rotateRight (T val, int count) |
Static Public Member Functions |
| jlong | decodeIntegerNumber (IN(RString) str, INOUT(bool) tryOnly, INOUT(char) typeChar, INOUT(int) ignoreaTrailing, bool ignoreLeadingWs=false) throw ( RNumberFormatException ) |
| jlong | parseIntegerNumber (IN(RString) str, int radix, INOUT(bool) tryOnly, INOUT(char) typeChar, INOUT(int) ignoreTrailing, bool ignoreLeadingSpaces=false) throw ( RNumberFormatException ) |
| double | parseFloatNumber (IN(RString) str, INOUT(bool) tryOnly, INOUT(char) typeChar, INOUT(int) ignoreTrailing, bool ignoreLeadingSpaces=false, IN(acdk::util::RLocale) locale=Nil) throw ( RNumberFormatException ) |
| | working method
|
| char | getSmallestTypeChar (jlong number) |
| | return one of the typeChar which fits this number
|
| char | getSmallestTypeChar (double number) |
| | return one of the float type char, in which this number fits
|
| RNumber | getNumber (jlong value, char typeChar=0) throw ( RNumberFormatException ) |
| | creates a number instance of given value.
|
| RNumber | getNumber (double value, char typeChar=0) throw ( RNumberFormatException ) |
| | creates a number instance of given value.
|
| RNumber | decodeToNumber (IN(RString) str, bool tryOnly=false, bool ignoreLeadingWs=false, IN(acdk::util::RLocale) locale=Nil) throw ( RNumberFormatException ) |
| | Parses a number from a unicode string if the string is a decimal string (radix = 10) all unicode character are allowed, which are digits (not limited to 0 - 9).
|
| RNumber | parseToIntegerNumber (IN(RString) str, int radix, bool tryOnly=false, bool ignoreLeadingSpaces=false) throw ( RNumberFormatException ) |
| | parses a string to given integer number
|
| void | getFractionAndExponentSignFromLocale (IN(acdk::util::RLocale) locale, OUT(ucchar) fraction, OUT(ucchar) exponent) |
| void | swap2 (char *ptr) |
| void | swap4 (char *ptr) |
| void | swap8 (char *ptr) |
Constructor & Destructor Documentation
| acdk::lang::Number::Number |
( |
|
) |
[inline] |
|
Member Function Documentation
|
template<class T> |
| template_static int acdk::lang::Number::bitCount |
( |
T |
val |
) |
[inline] |
|
| virtual byte acdk::lang::Number::byteValue |
( |
|
) |
[pure virtual] |
|
| jlong acdk::lang::Number::decodeIntegerNumber |
( |
IN(RString) |
str, |
|
|
INOUT(bool) |
tryOnly, |
|
|
INOUT(char) |
typeChar, |
|
|
INOUT(int) |
ignoreaTrailing, |
|
|
bool |
ignoreLeadingWs = false |
|
) |
throw ( RNumberFormatException ) [static] |
|
|
|
Parses a number from a unicode string if the string is a decimal string (radix = 10) all unicode character are allowed, which are digits (not limited to 0 - 9).
- Parameters:
-
| str | the string to parse |
| tryOnly | if tryOnly is true this method does'nt throw a RNumberFormatException, but only returns Nil if the string cannot be decoded to a number |
| ignoreLeadingWs | ignore leading white spaces |
| locale | if locale is Nil it uses the C / en_US locale otherwise the given locale to parse the float number |
|
| virtual double acdk::lang::Number::doubleValue |
( |
|
) |
[pure virtual] |
|
| virtual float acdk::lang::Number::floatValue |
( |
|
) |
[pure virtual] |
|
|
template<class T> |
| template_static T acdk::lang::Number::fromBigEndian |
( |
T |
t |
) |
[inline] |
|
|
template<class T> |
| template_static T acdk::lang::Number::fromLittleEndian |
( |
T |
t |
) |
[inline] |
|
|
template<class T> |
| template_static int acdk::lang::Number::getBitCountOf |
( |
T |
|
) |
[inline] |
|
|
|
- Parameters:
-
| locale | may be Nil |
| fraction | if locale is Nil it returns '.' |
| exponent | if locle is Nil it returns 'e' |
|
|
|
creates a number instance of given value.
If typeChar is not given (= 0) it returns a class, which the value fits in |
|
|
creates a number instance of given value.
If typeChar is not given (= 0) it returns a class, which the value fits in |
| char acdk::lang::Number::getSmallestTypeChar |
( |
double |
number |
) |
[static] |
|
|
|
return one of the float type char, in which this number fits
|
| char acdk::lang::Number::getSmallestTypeChar |
( |
jlong |
number |
) |
[static] |
|
|
|
return one of the typeChar which fits this number
|
| virtual int acdk::lang::Number::hashCode |
( |
|
) |
[inline, virtual] |
|
| virtual int acdk::lang::Number::intValue |
( |
|
) |
[pure virtual] |
|
| virtual jlong acdk::lang::Number::longValue |
( |
|
) |
[pure virtual] |
|
| double acdk::lang::Number::parseFloatNumber |
( |
IN(RString) |
str, |
|
|
INOUT(bool) |
tryOnly, |
|
|
INOUT(char) |
typeChar, |
|
|
INOUT(int) |
ignoreTrailing, |
|
|
bool |
ignoreLeadingSpaces = false, |
|
|
IN(acdk::util::RLocale) |
locale = Nil |
|
) |
throw ( RNumberFormatException ) [static] |
|
|
|
working method
- Parameters:
-
| str | the string to parse |
| tryOnly | if parsing and the float cannot be parsed it does not throw an exception otherwise this param will be set to false if parsing failed |
| typeChar | hint which type was parsed |
| ignoreLeadingSpaces | ignore leading spaces |
| ignoreTrailing | if this is 0 it the method only succeed if the complete string was parsed otherwise it return the index position into the string where parsing was stopped |
| locale | if locale is Nil it uses the C / en_US locale otherwise the given locale to parse the float number see also decodeIntegerNumber |
|
| jlong acdk::lang::Number::parseIntegerNumber |
( |
IN(RString) |
str, |
|
|
int |
radix, |
|
|
INOUT(bool) |
tryOnly, |
|
|
INOUT(char) |
typeChar, |
|
|
INOUT(int) |
ignoreTrailing, |
|
|
bool |
ignoreLeadingSpaces = false |
|
) |
throw ( RNumberFormatException ) [static] |
|
|
|
- Parameters:
-
| tryOnly | if true, method doesn't throws RNumberFormatException In this case method set tryOnly = false and return error information in return value: 0 -> general number format error -1 -> over/underflow |
| typeChar | 'b' or 'B' -> byte 's' or 'S' -> short 'i' or 'I' -> integer 'l' or 'L' -> long 'f' or 'F' -> float 'd' or 'D' -> double if typeChar == 0 no asumption of type is given. If the postfix value is set in String, it will be set by this method |
|
|
|
parses a string to given integer number
|
|
template<class T> |
| template_static T acdk::lang::Number::rotateLeft |
( |
T |
val, |
|
|
int |
count |
|
) |
[inline] |
|
|
template<class T> |
| template_static T acdk::lang::Number::rotateRight |
( |
T |
val, |
|
|
int |
count |
|
) |
[inline] |
|
| virtual short acdk::lang::Number::shortValue |
( |
|
) |
[pure virtual] |
|
| void acdk::lang::Number::swap2 |
( |
char * |
ptr |
) |
[inline, static] |
|
| void acdk::lang::Number::swap4 |
( |
char * |
ptr |
) |
[inline, static] |
|
| void acdk::lang::Number::swap8 |
( |
char * |
ptr |
) |
[inline, static] |
|
|
template<class T> |
| template_static T acdk::lang::Number::swapBits |
( |
T |
t |
) |
[inline] |
|
|
template<class T> |
| template_static T acdk::lang::Number::toBigEndian |
( |
T |
t |
) |
[inline] |
|
|
|
group to convert plattform pendig bit order to or from BigEndian which will be used in Serialization and network
|
|
template<class T> |
| template_static T acdk::lang::Number::toLittleEndian |
( |
T |
t |
) |
[inline] |
|
|
|