Inserters
[Pantheios Application Layer API]


Detailed Description

String inserters for fundamental types.

By using string access shims, strings, or those things that are expressible ( as String types, or

These classes are used to wrap instances of fundamental types in order to pass them into the Pantheios logging functions, as in:

  short         s     = 123;
  int           i     = 456;
  long          l     = 789;
  float         f     = static_cast<float>(0.123);
  double        d     = 0.456;
  long double   ld    = 0.789;
  void          *p    = reinterpret_cast<void*>(0x01230123);
  unsigned char ar[]  = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };

  pantheios::log_INFORMATIONAL( "This string contains: "
                              , "some integers (", pantheios::integer(s), ", ", pantheios::integer(i, 4 | pantheios::fmt::zeroPadded), ", ", pantheios::integer(l), "); "
                              , "some real numbers (", pantheios::real(f), ", ", pantheios::real(d), ", ", pantheios::real(ld), "); "
                              , "a pointer (", pantheios::pointer(p, pantheios::fmt::fullHex), "); "
                              , "and a blob (", pantheios::blob(&ar[0], sizeof(ar), ")"
                              );

which will produce the following output:

    This string contains: some integers (123, 0456, 789); some real numbers (0.123, 0.456, 0.789); a pointer (0x1230123); and a blob (0011223344)

Within the scope of a given function, it can be appropriate to use a using directive to reduce the clutter, as in:

  using namespace pantheios;

  short         s     = 123;
  int           i     = 456;
  long          l     = 789;
  float         f     = static_cast<float>(0.123);
  double        d     = 0.456;
  long double   ld    = 0.789;
  void          *p    = reinterpret_cast<void*>(0x01230123);
  unsigned char ar[]  = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };

  log_INFORMATIONAL( "This string contains: "
                   , "some integers (", integer(s), ", ", integer(i, 4 | fmt::zeroPadded), ", ", integer(l), "); "
                   , "some real numbers (", real(f), ", ", real(d), ", ", real(ld), "); "
                   , "and a pointer (", pointer(p, fmt::fullHex), "); "
                   , "and a blob (", blob(&ar[0], sizeof(ar), ")"
                   );

or using declarations, as in:

  using pantheios::log_INFORMATIONAL;
  using pantheios::blob;
  using pantheios::integer;
  using pantheios::real;
  using pantheios::pointer;
  using pantheios::fmt;

  short         s     = 123;
  int           i     = 456;
  long          l     = 789;
  float         f     = static_cast<float>(0.123);
  double        d     = 0.456;
  long double   ld    = 0.789;
  void          *p    = reinterpret_cast<void*>(0x01230123);
  unsigned char ar[]  = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };

  log_INFORMATIONAL( "This string contains: "
                   , "some integers (", integer(s), ", ", integer(i, 4 | fmt::zeroPadded), ", ", integer(l), "); "
                   , "some real numbers (", real(f), ", ", real(d), ", ", real(ld), "); "
                   , "and a pointer (", pointer(p, fmt::fullHex), "); "
                   , "and a blob (", blob(&ar[0], sizeof(ar), ")"
                   );


Classes

class  pantheios::b64
 Class for inserting binary regions types into Panthieos logging statements. More...
class  pantheios::blob
 Class for inserting binary regions types into Panthieos logging statements. More...
class  pantheios::character
 Class for inserting characters into Panthieos logging statements. More...
struct  pantheios::fmt
 Format constants used by Pantheios inserter classes. More...
class  pantheios::integer
 Class for inserting integral types into Panthieos logging statements. More...
class  pantheios::pointer
 Class for inserting pointer types into Panthieos logging statements. More...
class  pantheios::real
 Class for inserting floating-point types into Panthieos logging statements. More...

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