pantheios::pointer Class Reference
[Inserters]

#include <pantheios/inserters/pointer.hpp>

List of all members.


Detailed Description

Class for inserting pointer types into Panthieos 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/example_cpp_pointer/example_cpp_pointer.cpp.


Public Types

typedef pointer class_type

Public Member Functions

 pointer (void const *pv, int widthAndFormat)
 Construct from a pointer, with width/format specifier.
char const * data () const
 A possibly non-nul-terminated non-null pointer to the c-style string representation of the pointer.
char 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 pantheios::pointer::class_type
 


Constructor & Destructor Documentation

pantheios::pointer::pointer void const *  pv,
int  widthAndFormat
[explicit]
 

Construct from a pointer, with width/format specifier.


Member Function Documentation

char const* pantheios::pointer::c_str  )  const
 

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

char const* pantheios::pointer::data  )  const
 

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

size_t pantheios::pointer::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, 2006 SourceForge.net Logo