8#ifndef INCLUDED_BDLB_PRINT
9#define INCLUDED_BDLB_PRINT
155#include <bdlscm_version.h>
160#include <bsl_ostream.h>
161#include <bsl_utility.h>
182 static bsl::ostream&
indent(bsl::ostream& stream,
184 int spacesPerLevel = 4);
196 int spacesPerLevel = 4);
203 static void printPtr(bsl::ostream& stream,
const void *value);
217 bool escapeBackSlash =
false);
223 static bsl::ostream&
hexDump(bsl::ostream& stream,
236 static bsl::ostream&
hexDump(bsl::ostream& stream,
247 template <
class INPUT_ITERATOR>
249 INPUT_ITERATOR begin,
357template <
class INPUT_ITERATOR>
359 INPUT_ITERATOR begin,
362 enum { k_LOCAL_BUF_SIZE = 512 };
363 static const char HEX[] =
"0123456789ABCDEF";
365 char buf[k_LOCAL_BUF_SIZE];
367 unsigned int offset = 0;
369 for (; begin != end; ++begin) {
371 if (offset >= (k_LOCAL_BUF_SIZE - 1)) {
372 stream.write(buf, offset);
376 const unsigned char c = *begin;
378 buf[offset++] = HEX[(c >> 4) & 0xF];
379 buf[offset++] = HEX[c & 0xF];
383 stream.write(buf, offset);
420 const PrintStringHexDumper& rhs)
422 return Print::hexDump(stream, rhs.d_data_p, rhs.d_length);
446 const PrintStringSingleLineHexDumper& rhs)
448 return Print::singleLineHexDump(stream, rhs.d_data_p, rhs.d_length);
Definition bslstl_pair.h:1210
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_REVIEW(X)
Definition bsls_review.h:949
Definition bdlb_algorithmworkaroundutil.h:74
bsl::ostream & operator<<(bsl::ostream &stream, const BigEndianInt16 &integer)
Definition bdlb_print.h:288
int d_length
Definition bdlb_print.h:292
const char * d_data_p
Definition bdlb_print.h:291
PrintStringHexDumper(const char *data, int length)
Definition bdlb_print.h:406
Definition bdlb_print.h:326
const char * d_data_p
Definition bdlb_print.h:329
PrintStringSingleLineHexDumper(const char *data, int length)
Definition bdlb_print.h:432
int d_length
Definition bdlb_print.h:330
Definition bdlb_print.h:171
static void printPtr(bsl::ostream &stream, const void *value)
static bsl::ostream & singleLineHexDump(bsl::ostream &stream, const char *begin, const char *end)
static bsl::ostream & newlineAndIndent(bsl::ostream &stream, int level, int spacesPerLevel=4)
static bsl::ostream & indent(bsl::ostream &stream, int level, int spacesPerLevel=4)
static bsl::ostream & hexDump(bsl::ostream &stream, const char *buffer, int length)
static bsl::ostream & printString(bsl::ostream &stream, const char *string, int length, bool escapeBackSlash=false)
static bsl::ostream & singleLineHexDump(bsl::ostream &stream, INPUT_ITERATOR begin, INPUT_ITERATOR end)
Definition bdlb_print.h:358
static bsl::ostream & hexDump(bsl::ostream &stream, bsl::pair< const char *, int > *buffers, int numBuffers)