#include <Raw.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
 

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 20 of file Raw.h.

Constructor & Destructor Documentation

◆ Raw()

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

Definition at line 23 of file Raw.h.

Member Function Documentation

◆ gap()

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

Definition at line 32 of file Raw.h.

References useGap_.

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

◆ hex()

Raw & Raw::hex ( )
inline

Definition at line 30 of file Raw.h.

References useHex_.

Referenced by Parser::BinaryTokenizer::got(), and Store::operator<<().

◆ minLevel()

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

Definition at line 27 of file Raw.h.

References level.

Referenced by Http::Tunneler::handleResponse(), and Store::operator<<().

◆ 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 17 of file Raw.cc.

References data_, DBG_DATA, label_, level, PrintHex(), Debug::SectionLevel(), size_, useGap_, and useHex_.

Referenced by operator<<().

◆ printHex()

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

Member Data Documentation

◆ data_

const char* Raw::data_
private

Definition at line 51 of file Raw.h.

Referenced by print().

◆ label_

const char* Raw::label_
private

Definition at line 50 of file Raw.h.

Referenced by print().

◆ 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 45 of file Raw.h.

Referenced by minLevel(), and print().

◆ size_

size_t Raw::size_
private

Definition at line 52 of file Raw.h.

Referenced by print().

◆ useGap_

bool Raw::useGap_
private

Definition at line 54 of file Raw.h.

Referenced by gap(), and print().

◆ useHex_

bool Raw::useHex_
private

Definition at line 53 of file Raw.h.

Referenced by hex(), and print().


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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors