|
|
|
|
|
#include <pantheios/inserters/hex_ptr.hpp>

This class acts as a syntactic shorthand for the pantheios::pointer inserter class, by supplying the common width/format values in a defaulted constructor argument. Just as does pantheios::pointer, it converts a pointer variable into a string, thereby enabling it to be inserted into a logging statement.
Consider the following statement:
void* p = reinterpret_cast<void*>(0x01234567); char s[] = "abc"; std::string str("def"); pantheios::log(pantheios::notice, "s=", s, ", p=", pantheios::hex_ptr(p), ", str=", str);
On a 32-bit system, this will produce the output:
s=abc, p=0x01234567, str=def
On a 64-bit system, this will produce the output:
s=abc, p=0x0000000001234567, str=def
xp inserter cpp/inserters/example.cpp.inserter.hex_ptr/example.cpp.inserter.hex_ptr.cpp, cpp/inserters/example.cpp.inserter.p/example.cpp.inserter.p.cpp, cpp/inserters/example.cpp.inserter.pointer/example.cpp.inserter.pointer.cpp, and cpp/inserters/example.cpp.inserter.xp/example.cpp.inserter.xp.cpp.
Public Types | |
| enum | { pointerHexWidth = sizeof(void*) * 2 } |
Public Member Functions | |
| hex_ptr (void const volatile *p, int flags) | |
| [DEPRECATED] Construct from a pointer, with width/format specifier | |
| hex_ptr (void const volatile *p) | |
| Construct from a pointer, using the ambient pointer width and pantheios::fmt::fullHex format. | |
| hex_ptr (void const volatile *p, int minWidth, int format) | |
| Construct from a pointer, with width/format specifier. | |
| anonymous enum |
| pointerHexWidth | The maximum number of characters required to express any pointer value as a hex string |
| hex_ptr | ( | void const volatile * | p, | |
| int | flags | |||
| ) | [inline] |
[DEPRECATED] Construct from a pointer, with width/format specifier
| p | The pointer whose value will be represented as a string | |
| flags | The width/format specifiers. Defaults to pointerHexWidth | pantheios::fmt::fullHex |
| hex_ptr | ( | void const volatile * | p | ) | [inline, explicit] |
Construct from a pointer, using the ambient pointer width and pantheios::fmt::fullHex format.
| p | The pointer whose value will be represented as a string |
| hex_ptr | ( | void const volatile * | p, | |
| int | minWidth, | |||
| int | format | |||
| ) | [inline] |
|
|
|
| pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 |
|