#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 179 of file Debug.h.

Constructor & Destructor Documentation

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

Definition at line 182 of file Debug.h.

Member Function Documentation

Raw& Raw::hex ( )
inline

Definition at line 189 of file Debug.h.

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

Raw& Raw::minLevel ( const int  aLevel)
inline

Definition at line 186 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 885 of file debug.cc.

References DBG_DATA, and Debug::SectionLevel().

Referenced by operator<<().

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

Definition at line 873 of file debug.cc.

References for_each().

Member Data Documentation

const char* Raw::data_
private

Definition at line 208 of file Debug.h.

const char* Raw::label_
private

Definition at line 207 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 202 of file Debug.h.

size_t Raw::size_
private

Definition at line 209 of file Debug.h.

bool Raw::useHex_
private

Definition at line 210 of file Debug.h.


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors