#include <Debug.h>

Collaboration diagram for Raw:

Public Member Functions

 Raw (const char *label, const char *data, const size_t size)
RawminLevel (const int aLevel)
 limit data printing to at least the given debugging level More...
Rawhex ()
 print data using two hex digits per byte (decoder: xxd -r -p) More...
std::ostream & print (std::ostream &os) const

Public Attributes

int level

Private Member Functions

void printHex (std::ostream &os) const
 print data bytes using hex notation More...

Private Attributes

const char * label_
 optional data name or ID; triggers size printing More...
const char * data_
 raw data to be printed More...
size_t size_
 data length More...
bool useHex_
 whether hex() has been called More...

Detailed Description

Prints raw and/or non-terminated data safely, efficiently, and beautifully. Allows raw data debugging in debugs() statements with low debugging levels by printing only if higher section debugging levels are configured: debugs(11, DBG_IMPORTANT, "always printed" << Raw(may be printed...));

Definition at line 177 of file Debug.h.

Constructor & Destructor Documentation

Raw::Raw ( const char *  label,
const char *  data,
const size_t  size 

Definition at line 180 of file Debug.h.

Member Function Documentation

Raw& Raw::hex ( )

Definition at line 187 of file Debug.h.

Referenced by Downloader::CbDialer::print().

Raw& Raw::minLevel ( const int  aLevel)

Definition at line 184 of file Debug.h.

std::ostream & Raw::print ( std::ostream &  os) const

If debugging is prohibited by the current debugs() or section level, prints nothing. Otherwise, dumps data using one of these formats: " label[size]=data" if label was set and data size is positive " label[0]" if label was set and data size is zero " data" if label was not set and data size is positive "" (i.e., prints nothing) if label was not set and data size is zero

Definition at line 862 of file debug.cc.

References DBG_DATA, and Debug::SectionLevel().

Referenced by operator<<().

void Raw::printHex ( std::ostream &  os) const

Definition at line 850 of file debug.cc.

References for_each().

Member Data Documentation

const char* Raw::data_

Definition at line 206 of file Debug.h.

const char* Raw::label_

Definition at line 205 of file Debug.h.

int Raw::level

Minimum section debugging level necessary for printing. By default, small strings are always printed while large strings are only printed if DBG_DATA debugging level is enabled.

Definition at line 200 of file Debug.h.

size_t Raw::size_

Definition at line 207 of file Debug.h.

bool Raw::useHex_

Definition at line 208 of file Debug.h.

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






Web Site Translations