Quick Links:

bal | bbl | bdl | bsl

Static Public Member Functions

bdlb::Print Struct Reference

#include <bdlb_print.h>

List of all members.

Static Public Member Functions

static bsl::ostream & indent (bsl::ostream &stream, int level, int spacesPerLevel=4)
static bsl::ostream & newlineAndIndent (bsl::ostream &stream, int level, int spacesPerLevel=4)
static void printPtr (bsl::ostream &stream, const void *value)
static bsl::ostream & printString (bsl::ostream &stream, const char *string, int length, bool escapeBackSlash=false)
static bsl::ostream & hexDump (bsl::ostream &stream, const char *buffer, int length)
static bsl::ostream & hexDump (bsl::ostream &stream, bsl::pair< const char *, int > *buffers, int numBuffers)
template<class INPUT_ITERATOR >
static bsl::ostream & singleLineHexDump (bsl::ostream &stream, INPUT_ITERATOR begin, INPUT_ITERATOR end)
static bsl::ostream & singleLineHexDump (bsl::ostream &stream, const char *begin, const char *end)
static bsl::ostream & singleLineHexDump (bsl::ostream &stream, const char *buffer, int length)

Detailed Description

Provide a namespace for the interface to a suite of procedural stream operations.

See Component bdlb_print


Member Function Documentation

static bsl::ostream& bdlb::Print::indent ( bsl::ostream &  stream,
int  level,
int  spacesPerLevel = 4 
) [static]

Emit to the specified output stream the number of spaces (' ') equal to the absolute value of the product of the specified level and spacesPerLevel or, if level is negative, nothing at all. Return a reference providing modifiable access to stream. The behavior is undefined unless the absolute value of the product of the specified level and spacesPerLevel is representable as int.

static bsl::ostream& bdlb::Print::newlineAndIndent ( bsl::ostream &  stream,
int  level,
int  spacesPerLevel = 4 
) [static]

Emit to the specified stream a newline (\n) followed by the number of spaces (' ') equal to the absolute value of the product of the specified level and spacesPerLevel or, if spacesPerLevel is negative, emit a single space (and no newline). Return a reference providing modifiable access to stream. The behavior is undefined unless the absolute value of the product of the specified level and spacesPerLevel is representable as int.

static void bdlb::Print::printPtr ( bsl::ostream &  stream,
const void *  value 
) [static]

Print to the specified stream the specified pointer value in a standard format. The output is in hexadecimal format with a maximum length of 2 * sizeof(void *). The output does not have leading zeros and is not preceded by 0x. The hexadecimal digits (a to f, inclusive) are expressed in lower case.

static bsl::ostream& bdlb::Print::printString ( bsl::ostream &  stream,
const char *  string,
int  length,
bool  escapeBackSlash = false 
) [static]

Print to the specified stream the specified string of the specified length and return a reference providing modifiable access to stream. If the optionally specified escapeBackSlash flag is true, then all occurrences of the backslash character (\) in the string are escaped (i.e., expanded to "\\") when written to the stream. Note that non-printable characters in string will be printed in their hexadecimal representation (\xHH). If stream is not valid on entry, this operation has no effect. The behavior is undefined unless 0 <= length.

static bsl::ostream& bdlb::Print::hexDump ( bsl::ostream &  stream,
const char *  buffer,
int  length 
) [static]

Print in hexadecimal format the contents of the specified buffer of the specified length to the specified stream, and return a reference providing modifiable access to stream. The behavior is undefined unless 0 <= length.

static bsl::ostream& bdlb::Print::hexDump ( bsl::ostream &  stream,
bsl::pair< const char *, int > *  buffers,
int  numBuffers 
) [static]

Print to the specified stream the specified numBuffers buffers supplied by specified buffers in a hexadecimal representation (16 chars per line) followed by the ASCII representation. Return a reference providing modifiable access to stream. The array of buffers are supplied as a bsl::pair<const char*, int> * where the first element is a pointer to the data, and the second element is the length of the buffer. The behavior is undefined unless 0 <= numBuffers. Note that the contents of the buffers are concatenated and boundaries between buffers are not demarcated.

template<class INPUT_ITERATOR >
static bsl::ostream& bdlb::Print::singleLineHexDump ( bsl::ostream &  stream,
INPUT_ITERATOR  begin,
INPUT_ITERATOR  end 
) [static]

Print to the specified stream the uppercase hex encoding of the byte sequence defined by the specified begin and end iterators of the parameterized INPUT_ITERATOR type, and return a reference providing modifiable access to stream. Note that INPUT_ITERATOR need not be random-access, i.e., it need support only increment (++) and equality comparison (==). See the non-template version of this function if insulation and/or code bloat are a concern.

static bsl::ostream& bdlb::Print::singleLineHexDump ( bsl::ostream &  stream,
const char *  begin,
const char *  end 
) [static]

Print to the specified stream the uppercase hex encoding of the byte sequence defined by the specified begin and end iterators into the specified stream, and return a reference providing modifiable access to stream. This function insulates clients from its implementation, but unlike the member template version (above), requires random access iterators of type const char *. The behavior is undefined unless both begin and end refer to the same block of contiguous memory, and begin <= end.

static bsl::ostream& bdlb::Print::singleLineHexDump ( bsl::ostream &  stream,
const char *  buffer,
int  length 
) [static]

Print to the specified stream the contents of the specified buffer having the specified length on a single line, and return a reference to the modifiable stream. The behavior is undefined unless 0 <= length.


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