NDEVR
API Documentation
NumberWriter

Logic for writing to a number. More...

Public Types

enum  flt_to_string { DTOSTR_NORMAL , DTOSTR_FIXED , DTOSTR_PRECISION , DTOSTR_EXPONENTIAL }
 Specifies the formatting mode for floating-point to string conversion. More...

Static Public Member Functions

static void writeFloat (String &string, fltp08 value, flt_to_string mode=DTOSTR_NORMAL, uint01 precision=10)
 Writes a double-precision floating-point value as a string representation.
template<class t_type>
static constexpr void writeHex (String &string, t_type initial_value)
 Writes an integer value as its hexadecimal string representation into the given string.
template<class t_type>
static constexpr void writeInt (String &string, t_type initial_value)
 Writes an integer value as its decimal string representation into the given string.

Detailed Description

Logic for writing to a number.


Definition at line 51 of file NumberWriter.h.

Member Enumeration Documentation

◆ flt_to_string

Specifies the formatting mode for floating-point to string conversion.

Enumerator
DTOSTR_NORMAL 

Default formatting, choosing the shortest accurate representation.

DTOSTR_FIXED 

Fixed-point notation with a specified number of decimal places.

DTOSTR_PRECISION 

Precision mode with a specified number of significant digits.

DTOSTR_EXPONENTIAL 

Scientific/exponential notation (e.g. 1.23e+4).

Definition at line 315 of file NumberWriter.h.

Member Function Documentation

◆ writeFloat()

void NumberWriter::writeFloat ( String & string,
fltp08 value,
flt_to_string mode = DTOSTR_NORMAL,
uint01 precision = 10 )
inlinestatic

Writes a double-precision floating-point value as a string representation.

Parameters
[in]stringThe string to append the float representation to.
[in]valueThe double value to convert.
[in]modeThe formatting mode controlling output style.
[in]precisionThe number of digits of precision to use.

Internal format type used to select the digit generation strategy.

< Standard decimal notation.

< Scientific notation with exponent.

< Fractional form (0.xxxx).

< Fixed fractional form with specified decimal places.

Definition at line 415 of file NumberWriter.h.

◆ writeHex()

template<class t_type>
constexpr void NumberWriter::writeHex ( String & string,
t_type initial_value )
inlinestaticconstexpr

Writes an integer value as its hexadecimal string representation into the given string.

Parameters
[in]stringThe string to append the hexadecimal representation to.
[in]initial_valueThe integer value to convert.

Definition at line 367 of file NumberWriter.h.

◆ writeInt()

template<class t_type>
constexpr void NumberWriter::writeInt ( String & string,
t_type initial_value )
inlinestaticconstexpr

Writes an integer value as its decimal string representation into the given string.

Parameters
[in]stringThe string to append the integer representation to.
[in]initial_valueThe integer value to convert.

Definition at line 328 of file NumberWriter.h.


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