pantheios::blob Class Reference
[Inserters]

#include <pantheios/inserters/blob.hpp>

List of all members.


Detailed Description

Class for inserting binary regions types into Panthieos logging statements.

This class formats a binary region into a string, thereby enabling it to be inserted into a logging statement. Consider the following statement:

  int         ar[2] = { 0x00112233, 0x44556677 };
  char        s[]   = "abc";
  std::string str("def");

  pantheios::log(pantheios::notice, "s=", s, ", blob=", pantheios::blob(ar, sizeof(ar)), ", str=", str);

This will produce the output:

   s=abc, blob=0011223344556677, str=def

The bytes can be grouped and these groups separated. Consider the following statement:

  int         ar[2] = { 0x00112233, 0x44556677 };
  char        s[]   = "abc";
  std::string str("def");

  pantheios::log(pantheios::notice, "s=", s, ", blob=", pantheios::blob(ar, sizeof(ar), 2, "-"), ", str=", str);

This will produce the output:

   s=abc, blob=2233-0011-6677-4455, str=def

The output can be split into lines. Consider the following statement:

  int         ar[2] = { 0x00112233, 0x44556677 };
  char        s[]   = "abc";
  std::string str("def");

  pantheios::log(pantheios::notice, "s=", s, ", blob=", pantheios::blob(ar, sizeof(ar), 2, "-", 3, "\n\t"), ", str=", str);

This will produce the output:

  s=abc, blob=2233-0011-6677
          4455, str=def
Examples:

cpp/example_cpp_blob/example_cpp_blob.cpp.


Public Types

Member Types
typedef blob class_type

Public Member Functions

Construction
 blob (void const *pv, size_t cb)
 Constructs a blob inserter that will display as an unbroken sequence of hexadecimal digits.
 blob (void const *pv, size_t cb, unsigned bytesPerGroup, char const *groupSeparator)
 Constructs a blob inserter that will break the sequence of hexadecimal digits into groups of the specified number of bytes, separating groups with the specified separator.
 blob (void const *pv, size_t cb, unsigned bytesPerGroup, char const *groupSeparator, int groupsPerLine, char const *lineSeparator="\n")
 Constructs a blob inserter that will break the sequence of hexadecimal digits into groups of the specified number of bytes, separating groups with the specified separator, and break into lines of the specified number of groups, using the given line separator.
 ~blob () stlsoft_throw_0()
 Releases any storage associated with the instance.
Accessors
char const * data () const
 A possibly non-nul-terminated non-null pointer to the c-style string representation of the integer.
char 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.


Member Typedef Documentation

typedef blob pantheios::blob::class_type
 


Constructor & Destructor Documentation

pantheios::blob::blob void const *  pv,
size_t  cb
 

Constructs a blob inserter that will display as an unbroken sequence of hexadecimal digits.

Parameters:
pv Pointer to the first byte in the sequence to be displayed.
cb Number of bytes in the sequence.

pantheios::blob::blob void const *  pv,
size_t  cb,
unsigned  bytesPerGroup,
char const *  groupSeparator
 

Constructs a blob inserter that will break the sequence of hexadecimal digits into groups of the specified number of bytes, separating groups with the specified separator.

Parameters:
pv Pointer to the first byte in the sequence to be displayed.
cb Number of bytes in the sequence.
bytesPerGroup Number of bytes per group. Must be a power of 2.
groupSeparator The string used to separate the byte groups.

pantheios::blob::blob void const *  pv,
size_t  cb,
unsigned  bytesPerGroup,
char const *  groupSeparator,
int  groupsPerLine,
char const *  lineSeparator = "\n"
 

Constructs a blob inserter that will break the sequence of hexadecimal digits into groups of the specified number of bytes, separating groups with the specified separator, and break into lines of the specified number of groups, using the given line separator.

Parameters:
pv Pointer to the first byte in the sequence to be displayed.
cb Number of bytes in the sequence.
bytesPerGroup Number of bytes per group. Must be a power of 2.
groupSeparator The string used to separate the byte groups.
groupsPerLine Number of groups per line.
lineSeparator The string used to separate the lines.

pantheios::blob::~blob  ) 
 

Releases any storage associated with the instance.


Member Function Documentation

char const* pantheios::blob::c_str  )  const
 

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

char const* pantheios::blob::data  )  const
 

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

size_t pantheios::blob::length  )  const
 

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


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

pantheios Library documentation © Matthew Wilson, 2006 SourceForge.net Logo