|
#include <pantheios/inserters/integer.hpp>
This class converts an integer into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement
int i = 123; char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", i=", pantheios::integer(i), ", str=", str);
This will produce the output:
s=abc, i=123, str=def
The constructor takes a second, defaulted (to 0), parameter, which allows a width (up to a maximum of 255) and a format to be specified. The low 8 bits of this parameter are interpreted as an unsigned integer specifying the width. The remaining bits are treated as bit flags that control the
cpp/format/example.cpp.format.highres/example.cpp.format.highres.cpp, cpp/format/example.cpp.format.lowres/example.cpp.format.lowres.cpp, cpp/inserters/example.cpp.inserter.i/example.cpp.inserter.i.cpp, cpp/inserters/example.cpp.inserter.integer/example.cpp.inserter.integer.cpp, cpp/misc/example.cpp.misc.101/example.cpp.misc.101.cpp, and cpp/misc/example.cpp.misc.custom_type_1/example.cpp.misc.custom_type_1.cpp.
Public Types | |
Member Types | |
typedef integer | class_type |
Public Member Functions | |
Construction | |
integer (::stlsoft::sint8_t i, int widthAndFormat) | |
[DEPRECATED] Construct from an 8-bit signed integer | |
integer (::stlsoft::uint8_t i, int widthAndFormat) | |
[DEPRECATED] Construct from an 8-bit unsigned integer | |
integer (::stlsoft::sint16_t i, int widthAndFormat) | |
[DEPRECATED] Construct from a 16-bit signed integer | |
integer (::stlsoft::uint16_t i, int widthAndFormat) | |
[DEPRECATED] Construct from a 16-bit unsigned integer | |
integer (::stlsoft::sint32_t i, int widthAndFormat) | |
[DEPRECATED] Construct from a 32-bit signed integer | |
integer (::stlsoft::uint32_t i, int widthAndFormat) | |
[DEPRECATED] Construct from a 32-bit unsigned integer | |
integer (::stlsoft::sint8_t i) | |
Construct from an 8-bit signed integer. | |
integer (::stlsoft::uint8_t i) | |
Construct from an 8-bit unsigned integer. | |
integer (::stlsoft::sint16_t i) | |
Construct from a 16-bit signed integer. | |
integer (::stlsoft::uint16_t i) | |
Construct from a 16-bit unsigned integer. | |
integer (::stlsoft::sint32_t i) | |
Construct from a 32-bit signed integer. | |
integer (::stlsoft::uint32_t i) | |
Construct from a 32-bit unsigned integer. | |
integer (::stlsoft::sint8_t i, int minWidth, int format) | |
Construct from an 8-bit signed integer. | |
integer (::stlsoft::uint8_t i, int minWidth, int format) | |
Construct from an 8-bit unsigned integer. | |
integer (::stlsoft::sint16_t i, int minWidth, int format) | |
Construct from a 16-bit signed integer. | |
integer (::stlsoft::uint16_t i, int minWidth, int format) | |
Construct from a 16-bit unsigned integer. | |
integer (::stlsoft::sint32_t i, int minWidth, int format) | |
Construct from a 32-bit signed integer. | |
integer (::stlsoft::uint32_t i, int minWidth, int format) | |
Construct from a 32-bit unsigned integer. | |
Accessors | |
pan_char_t const * | data () const |
A possibly non-nul-terminated non-null pointer to the c-style string representation of the integer. | |
pan_char_t const * | c_str () const |
A nul-terminated non-null pointer to the c-style string representation of the integer. | |
size_t | length () const |
The length of the c-style string representation of the integer. | |
Classes | |
union | u |
integer | ( | ::stlsoft::sint8_t | i, | |
int | widthAndFormat | |||
) | [explicit] |
[DEPRECATED] Construct from an 8-bit signed integer
integer | ( | ::stlsoft::uint8_t | i, | |
int | widthAndFormat | |||
) | [explicit] |
[DEPRECATED] Construct from an 8-bit unsigned integer
integer | ( | ::stlsoft::sint16_t | i, | |
int | widthAndFormat | |||
) | [explicit] |
[DEPRECATED] Construct from a 16-bit signed integer
integer | ( | ::stlsoft::uint16_t | i, | |
int | widthAndFormat | |||
) | [explicit] |
[DEPRECATED] Construct from a 16-bit unsigned integer
integer | ( | ::stlsoft::sint32_t | i, | |
int | widthAndFormat | |||
) | [explicit] |
[DEPRECATED] Construct from a 32-bit signed integer
integer | ( | ::stlsoft::uint32_t | i, | |
int | widthAndFormat | |||
) | [explicit] |
[DEPRECATED] Construct from a 32-bit unsigned integer
integer | ( | ::stlsoft::sint8_t | i, | |
int | minWidth, | |||
int | format | |||
) | [explicit] |
integer | ( | ::stlsoft::uint8_t | i, | |
int | minWidth, | |||
int | format | |||
) | [explicit] |
integer | ( | ::stlsoft::sint16_t | i, | |
int | minWidth, | |||
int | format | |||
) | [explicit] |
integer | ( | ::stlsoft::uint16_t | i, | |
int | minWidth, | |||
int | format | |||
) | [explicit] |
integer | ( | ::stlsoft::sint32_t | i, | |
int | minWidth, | |||
int | format | |||
) | [explicit] |
integer | ( | ::stlsoft::uint32_t | i, | |
int | minWidth, | |||
int | format | |||
) | [explicit] |
pan_char_t const* data | ( | ) | const |
pan_char_t const* c_str | ( | ) | const |
size_t length | ( | ) | const |
The length of the c-style string representation of the integer.
|
|
pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 |