Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions

IFR_Retcode IFRUtil_VDNNumber::numberToString ( unsigned char *  number,
char *  buffer,
IFR_size_t  bufferlength,
IFR_StringEncoding  encoding,
IFR_Bool  fixed,
IFR_Int4  length,
IFR_Int4  precision 
) [static]

Universal method for converting a number into a string. The resulting buffer must have room for length + 2 chars (fixed types) or length + 7 chars (floating-point types). Fixed-point numbers are converted with their whole precision (trailing zeros after the decimal point). Floating-point numbers which have an absolute value < 1.0E-4 or > 1.0E+7 are displayed in scientific notation.

Parameters:
number The VDN Number.
buffer The destination buffer.
bufferlength The number of bytes in the buffer, including the place for the null-terminator.
encoding The encoding of the buffer.
fixed Whether the number to be converted is a fixed or a floating-point type.
length Total number of digits (max. value)
precision Number of digits after the decimal point.
Returns:
IFR_OK if the conversion went ok, IFR_DATA_TRUNC if there was not enough room for the data in the buffer.

Definition at line 581 of file IFRUtil_VDNNumber.cpp.

References IFR_NOT_OK, IFR_StringEncodingAscii, IFR_StringEncodingUCS2, IFR_StringEncodingUCS2Swapped, and IFR_StringEncodingUTF8.

Referenced by IFRConversion_NumericConverter::translateCharacterOutput().

{
    if(encoding == IFR_StringEncodingAscii || encoding == IFR_StringEncodingUTF8) {
        return numberToStringAscii(number,
                                   buffer,
                                   bufferlength,
                                   fixed,
                                   length,
                                   precision);
    } else if(encoding==IFR_StringEncodingUCS2) {
        return numberToStringUCS2(number,
                                   buffer,
                                   bufferlength,
                                   fixed,
                                   length,
                                   precision);
    
    } else if(encoding==IFR_StringEncodingUCS2Swapped) {
        return numberToStringUCS2Swapped(number,
                                         buffer,
                                         bufferlength,
                                         fixed,
                                         length,
                                         precision);
        
    } else {
        return IFR_NOT_OK;
    }
}


Generated by  Doxygen 1.6.0   Back to index