cxxtools::HexDump Class Reference

Helper object for dumping content to output stream without creating another output stream. More...

#include <cxxtools/hdstream.h>

Public Member Functions

 HexDump (const char *p, unsigned n)

Friends

std::ostream & operator<< (std::ostream &out, const HexDump &hd)
 Outputs data to output stream as a hex dump.

Detailed Description

Helper object for dumping content to output stream without creating another output stream.

This makes dumping data a little more efficient than using hexDump(const char*, n), which creates a ostringstream, a cxxtools::Hdostream and a temporary std::string when printed to a output stream.

Constructor & Destructor Documentation

cxxtools::HexDump::HexDump ( const char *  p,
unsigned  n 
)
inline

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const HexDump hd 
)
friend

Outputs data to output stream as a hex dump.

Example:

const char* buffer = ...;
unsigned bufsize = ...
std::cout << HexDump(buffer, bufsize);

This outputs the content of the buffer to standard out as a hex dump.


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