|
#include <pantheios/inserters/real.hpp>
This class converts a floating-point variable into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement
double d = 123.456; char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", d=", pantheios::real(d), ", str=", str);
This will produce the output:
s=abc, d=123.456, str=def
cpp/inserters/example.cpp.inserter.real/example.cpp.inserter.real.cpp, and cpp/misc/example.cpp.misc.101/example.cpp.misc.101.cpp.
Public Types | |
typedef real | class_type |
This type. | |
Public Member Functions | |
real (float value, int widthAndFormat=0) | |
Construct from a float value. | |
real (double value, int widthAndFormat=0) | |
Construct from a double value. | |
real (long double value, int widthAndFormat=0) | |
Construct from a long double value. | |
pan_char_t const * | data () const |
A possibly non-nul-terminated non-null pointer to the c-style string representation of the floating-point number. | |
pan_char_t const * | c_str () const |
A nul-terminated non-null pointer to the c-style string representation of the floating-point number. | |
size_t | length () const |
The length of the c-style string representation of the floating-point number. | |
Classes | |
union | u |
typedef real class_type |
This type.
real | ( | float | value, | |
int | widthAndFormat = 0 | |||
) | [explicit] |
Construct from a float value.
value | The value to be inserted | |
widthAndFormat | Not currently used |
real | ( | double | value, | |
int | widthAndFormat = 0 | |||
) | [explicit] |
Construct from a double value.
value | The value to be inserted | |
widthAndFormat | Not currently used |
real | ( | long double | value, | |
int | widthAndFormat = 0 | |||
) | [explicit] |
Construct from a long double value.
value | The value to be inserted | |
widthAndFormat | Not currently used |
pan_char_t const* data | ( | ) | const |
A possibly non-nul-terminated non-null pointer to the c-style string representation of the floating-point number.
pan_char_t const* c_str | ( | ) | const |
A nul-terminated non-null pointer to the c-style string representation of the floating-point number.
size_t length | ( | ) | const |
The length of the c-style string representation of the floating-point number.
|
|
pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 |