#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...
 
Rawgap (bool useGap=true)
 
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...
 
bool useGap_
 whether to print leading space if label is missing 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 188 of file Debug.h.

Constructor & Destructor Documentation

◆ Raw()

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

Definition at line 191 of file Debug.h.

Member Function Documentation

◆ gap()

Raw& Raw::gap ( bool  useGap = true)
inline

Definition at line 200 of file Debug.h.

References useGap_.

Referenced by Http::Tunneler::handleResponse().

◆ hex()

Raw& Raw::hex ( )
inline

Definition at line 198 of file Debug.h.

References useHex_.

Referenced by Parser::BinaryTokenizer::got(), and Downloader::CbDialer::print().

◆ minLevel()

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

Definition at line 195 of file Debug.h.

References level.

Referenced by Http::Tunneler::handleResponse().

◆ print()

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 897 of file debug.cc.

References DBG_DATA, and Debug::SectionLevel().

Referenced by operator<<().

◆ printHex()

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

Definition at line 885 of file debug.cc.

References for_each().

Member Data Documentation

◆ data_

const char* Raw::data_
private

Definition at line 219 of file Debug.h.

◆ label_

const char* Raw::label_
private

Definition at line 218 of file Debug.h.

◆ level

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

Referenced by minLevel().

◆ size_

size_t Raw::size_
private

Definition at line 220 of file Debug.h.

◆ useGap_

bool Raw::useGap_
private

Definition at line 222 of file Debug.h.

Referenced by gap().

◆ useHex_

bool Raw::useHex_
private

Definition at line 221 of file Debug.h.

Referenced by hex().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors