Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

pointer Class Reference
[Inserters]

#include <pantheios/inserters/pointer.hpp>

Inheritance diagram for pointer:

hex_ptr xp

List of all members.


Detailed Description

Class for inserting pointers into Pantheios diagnostic logging statements.

This class 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::pointer(p, 8, pantheios::fmt::fullHex), ", str=", str);

This will produce the output:

    s=abc, p=0x01234567, str=def

Examples:

cpp/inserters/example.cpp.inserter.p/example.cpp.inserter.p.cpp, and cpp/inserters/example.cpp.inserter.pointer/example.cpp.inserter.pointer.cpp.


Public Types

typedef pointer class_type
 This type.

Public Member Functions

 pointer (void const volatile *pv, int widthAndFormat)
 [DEPRECATED] Construct from a pointer, with width/format specifier
 pointer (void const volatile *pv, int minWidth, int format)
 Construct from a pointer, specifying width and format.
pan_char_t const * data () const
 A possibly non-nul-terminated non-null pointer to the c-style string representation of the pointer.
pan_char_t const * c_str () const
 A nul-terminated non-null pointer to the c-style string representation of the pointer.
size_t length () const
 The length of the c-style string representation of the pointer.

Member Typedef Documentation

typedef pointer class_type

This type.

Reimplemented in xp.


Constructor & Destructor Documentation

pointer ( void const volatile *  pv,
int  widthAndFormat 
)

[DEPRECATED] Construct from a pointer, with width/format specifier

Parameters:
pv The pointer whose value will be inserted
widthAndFormat A bitwise combination of width and format. The width must be in the range [0, 20]
Deprecated:
This constructor form is deprecated, and will be removed in a forthcoming release
Note:
For backwards-compatibility, specifiying the zeroXPrefix flag also causes zeroPad to be assumed

pointer ( void const volatile *  pv,
int  minWidth,
int  format 
)

Construct from a pointer, specifying width and format.

Parameters:
pv The pointer whose value will be inserted
minWidth The minimum width. Must be in the range [-20, 20]
format Combination of format flags
Precondition:
(minWidth >= -20 && minWidth <= 20)


Member Function Documentation

pan_char_t const* data (  )  const

A possibly non-nul-terminated non-null pointer to the c-style string representation of the pointer.

pan_char_t const* c_str (  )  const

A nul-terminated non-null pointer to the c-style string representation of the pointer.

size_t length (  )  const

The length of the c-style string representation of the pointer.


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

pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo