BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bslalg::NumericFormatterUtil Struct Reference

#include <bslalg_numericformatterutil.h>

Detailed Description

Namespace struct for free functions supporting to_chars.

See bslalg_numericformatterutil

Classes

struct  FltMaxLen< double, NumericFormatterUtil::e_FIXED >
 
struct  FltMaxLen< double, NumericFormatterUtil::e_GENERAL >
 
struct  FltMaxLen< double, NumericFormatterUtil::e_HEX >
 
struct  FltMaxLen< double, NumericFormatterUtil::e_SCIENTIFIC >
 
struct  FltMaxLen< double, NumericFormatterUtil::k_MAXLEN_ARG_DEFAULT >
 
struct  FltMaxLen< float, NumericFormatterUtil::e_FIXED >
 
struct  FltMaxLen< float, NumericFormatterUtil::e_GENERAL >
 
struct  FltMaxLen< float, NumericFormatterUtil::e_HEX >
 
struct  FltMaxLen< float, NumericFormatterUtil::e_SCIENTIFIC >
 
struct  FltMaxLen< float, NumericFormatterUtil::k_MAXLEN_ARG_DEFAULT >
 
struct  PrecisionMaxBufferLength
 
struct  PrecisionMaxBufferLength< double >
 
struct  PrecisionMaxBufferLength< float >
 
struct  ToCharsMaxLength
 

Public Types

enum  Format { e_SCIENTIFIC = 0x040 , e_FIXED = 0x080 , e_HEX = 0x100 , e_GENERAL = e_FIXED | e_SCIENTIFIC }
 

Static Public Member Functions

static char * toChars (char *first, char *last, char value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, signed char value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, unsigned char value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, signed short int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, unsigned short int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, signed int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, unsigned int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, signed long int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, unsigned long int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, signed long long int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, unsigned long long int value, int base=10) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, double value) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, float value) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, double value, Format format) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, float value, Format format) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, double value, Format format, int precision) BSLS_KEYWORD_NOEXCEPT
 
static char * toChars (char *first, char *last, float value, Format format, int precision) BSLS_KEYWORD_NOEXCEPT
 

Member Enumeration Documentation

◆ Format

This enumeration lists the supported, explicitly specified 'toChars' formatting options for floating point values, according to ISO C++17.

Enumerator
e_SCIENTIFIC 
e_FIXED 
e_HEX 
e_GENERAL 

Member Function Documentation

◆ toChars() [1/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
char  value,
int  base = 10 
)
inlinestatic

Write the specified integral value into the character buffer starting.

included. If the optionally specified baseargument is not present base 10 is used. Return the address one past the last character (lowest order digit or last digit of the exponent) written on success, or 0 on failure. The only reason for failure is when the range [ first, last ) is not large enough to contain the result. The written result is to begin at first with leftover room following the return value.

Precondition
The behavior is undefined unless first <= last, and base is in the range [ 2 .. 36 ].
Note
Note that the type bool for the value parameter is explicitly disabled in the "NOT IMPLEMENTED" private section, because bool would otherwise be promoted to int and printed as 0 or 1, instead of the (possibly) expected false and true; and bool is not an integral or numeric type either. Also note that these functions do not null-terminate the result.

◆ toChars() [2/17]

static char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
double  value 
)
static

Write the specified floating point value into the character buffer starting a the specified first and ending at the specified last, last not included. Use the {Default Floating Point Format}. Return the address one past the last character (lowest order digit or last digit of the exponent) written on success, or 0 on failure. The only reason for failure is when the range [ first, last ) is not large enough to contain the result. The written result is to begin at first with leftover room following the return value.

Precondition
The behavior is undefined unless first <= last.
Note
Note that these functions do not null-terminate the result.

◆ toChars() [3/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
double  value,
Format  format 
)
inlinestatic

Write the specified floating point value into the character buffer starting a the specified first and ending at the specified last, last not included, using the specified format with the {Shortest (Textual) Decimal Representation for Binary Floating Point Values} used in that format (that will produce the exact binary floating point value when converted back to the original type from text), but see possible exceptions under {Special Floating Point Values}. Return the address one past the last character (lowest order digit or last digit of the exponent) written on success, or 0 on failure. The only reason for failure is when the range [ first, last ) is not large enough to contain the result. The written result is to begin at first with leftover room following the return value.

Precondition
The behavior is undefined unless first <= last.
Note
Note that these functions do not null-terminate the result.

◆ toChars() [4/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
double  value,
Format  format,
int  precision 
)
inlinestatic

Write the specified floating point value into the character buffer starting a the specified first and ending at the specified last, last not included, using the specified format and precision. Return the address one past the last character (lowest order digit or last digit of the exponent) written on success, or 0 on failure. The only reason for failure is when the range [ first, last ) is not large enough to contain the result. The written result is to begin at first with leftover room following the return value.

Precondition
The behavior is undefined unless first <= last.
Note
Note that these functions do not null-terminate the result.

◆ toChars() [5/17]

static char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
float  value 
)
static

◆ toChars() [6/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
float  value,
Format  format 
)
inlinestatic

◆ toChars() [7/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
float  value,
Format  format,
int  precision 
)
inlinestatic

◆ toChars() [8/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
signed char  value,
int  base = 10 
)
inlinestatic

◆ toChars() [9/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
signed int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [10/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
signed long int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [11/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
signed long long int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [12/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
signed short int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [13/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
unsigned char  value,
int  base = 10 
)
inlinestatic

◆ toChars() [14/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
unsigned int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [15/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
unsigned long int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [16/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
unsigned long long int  value,
int  base = 10 
)
inlinestatic

◆ toChars() [17/17]

char * bslalg::NumericFormatterUtil::toChars ( char *  first,
char *  last,
unsigned short int  value,
int  base = 10 
)
inlinestatic

The documentation for this struct was generated from the following file: