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>
185 static bsl::ostream&
indent(bsl::ostream& stream,
187 int spacesPerLevel = 4);
200 int spacesPerLevel = 4);
207 static void printPtr(bsl::ostream& stream,
const void *value);
223 bool escapeBackSlash =
false);
230 static bsl::ostream&
hexDump(bsl::ostream& stream,
245 static bsl::ostream&
hexDump(bsl::ostream& stream,
257 template <
class INPUT_ITERATOR>
259 INPUT_ITERATOR begin,
373template <
class INPUT_ITERATOR>
375 INPUT_ITERATOR begin,
378 enum { k_LOCAL_BUF_SIZE = 512 };
379 static const char HEX[] =
"0123456789ABCDEF";
381 char buf[k_LOCAL_BUF_SIZE];
383 unsigned int offset = 0;
385 for (; begin != end; ++begin) {
387 if (offset >= (k_LOCAL_BUF_SIZE - 1)) {
388 stream.write(buf, offset);
392 const unsigned char c = *begin;
394 buf[offset++] = HEX[(c >> 4) & 0xF];
395 buf[offset++] = HEX[c & 0xF];
399 stream.write(buf, offset);
436 const PrintStringHexDumper& rhs)
438 return Print::hexDump(stream, rhs.d_data_p, rhs.d_length);
462 const PrintStringSingleLineHexDumper& rhs)
464 return Print::singleLineHexDump(stream, rhs.d_data_p, rhs.d_length);
Definition bslstl_pair.h:1280
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_REVIEW(X)
Definition bsls_review.h:1019
Definition bdlb_algorithmworkaroundutil.h:74
bsl::ostream & operator<<(bsl::ostream &stream, const BigEndianInt16 &integer)
Definition bdlb_print.h:302
int d_length
Definition bdlb_print.h:306
const char * d_data_p
Definition bdlb_print.h:305
PrintStringHexDumper(const char *data, int length)
Definition bdlb_print.h:422
Definition bdlb_print.h:342
const char * d_data_p
Definition bdlb_print.h:345
PrintStringSingleLineHexDumper(const char *data, int length)
Definition bdlb_print.h:448
int d_length
Definition bdlb_print.h:346
Definition bdlb_print.h:173
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:374
static bsl::ostream & hexDump(bsl::ostream &stream, bsl::pair< const char *, int > *buffers, int numBuffers)