8#ifndef INCLUDED_BSLIM_PRINTER
9#define INCLUDED_BSLIM_PRINTER
570#include <bslscm_version.h>
583#include <bsl_optional.h>
584#include <bsl_ostream.h>
585#include <bsl_memory.h>
586#include <bsl_string.h>
587#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
588#include <bsl_tuple.h>
590#include <bsl_utility.h>
607 bsl::ostream *d_stream_p;
615 bool d_suppressInitialIndentFlag;
617 int d_spacesPerLevel;
647 void end(
bool suppressBracket =
false)
const;
649#ifndef BDE_OPENSOURCE_PUBLICATION
682 template <
class TYPE>
683 void print(
const TYPE& data,
const char *name)
const;
725 template <
class TYPE>
734 template <
class ITERATOR>
736 const ITERATOR& begin,
737 const ITERATOR& end)
const;
752 template <
class ITERATOR,
class PRINT_FUNCTOR>
754 const ITERATOR& begin,
756 const PRINT_FUNCTOR& printFunctionObject)
const;
775 template <
class TYPE,
class PRINT_FUNCTOR>
777 const PRINT_FUNCTOR& printFunctionObject,
778 const char *name)
const;
801 template <
class TYPE>
802 void printOrNull(
const TYPE& address,
const char *name)
const;
842 template <
class TYPE>
851 template <
class ITERATOR>
853 const ITERATOR& end)
const;
869 template <
class ITERATOR,
class PRINT_FUNCTOR>
872 const PRINT_FUNCTOR& printFunctionObject)
const;
885 void start(
bool suppressBracket =
false)
const;
914 template <
class TYPE>
915 static void print(bsl::ostream& stream,
927 template <
class ITERATOR>
928 static void print(bsl::ostream& stream,
929 const ITERATOR& begin,
941 template <
class ITERATOR,
class PRINT_FUNCTOR>
942 static void print(bsl::ostream& stream,
943 const ITERATOR& begin,
945 const PRINT_FUNCTOR& printFunctionObject,
947 const int spacesPerLevel);
966 template <
class TYPE>
967 static void printRaw(bsl::ostream& stream,
972 template <
class TYPE>
973 static void printRaw(bsl::ostream& stream,
981 template <
class TYPE>
982 static void printRaw(bsl::ostream& stream,
1000 template <
class TYPE>
1001 static void printRaw(bsl::ostream& stream,
1006 template <
class TYPE>
1007 static void printRaw(bsl::ostream& stream,
1015 static void printRaw(bsl::ostream& stream,
1020 template <
class TYPE>
1021 static void printRaw(bsl::ostream& stream,
1029 template <
class T1,
class T2>
1030 static void printRaw(bsl::ostream& stream,
1036#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
1038 template <
class t_TUPLE>
1039 static void printTupleElements(
Printer&,
1045 template <
int t_SIZE,
class t_TUPLE>
1046 static void printTupleElements(
Printer& printer,
1047 const t_TUPLE& data,
1050 template <
class... t_TYPES>
1051 static void printRaw(bsl::ostream& stream,
1052 const bsl::tuple<t_TYPES...>& data,
1070 template <
class TYPE>
1071 static void printRaw(bsl::ostream& stream,
1077 template <
class TYPE>
1078 static void printRaw(bsl::ostream& stream,
1088 template <
class TYPE>
1089 static void printRaw(bsl::ostream& stream,
1106#ifndef BDE_OPENSOURCE_PUBLICATION
1107template <
class TYPE>
1113 *d_stream_p << name <<
" = ";
1123template <
class TYPE>
1125 const TYPE& data)
const
1129 *d_stream_p << name <<
" = ";
1137template <
class ITERATOR>
1139 const ITERATOR& begin,
1140 const ITERATOR& end)
const
1144 *d_stream_p << name <<
" = ";
1153template <
class ITERATOR,
class PRINT_FUNCTOR>
1156 const ITERATOR& begin,
1157 const ITERATOR& end,
1158 const PRINT_FUNCTOR& printFunctionObject)
const
1162 *d_stream_p << name <<
" = ";
1167 printFunctionObject,
1172template <
class TYPE,
class PRINT_FUNCTOR>
1174 const PRINT_FUNCTOR& printFunctionObject,
1175 const char *name)
const
1180 *d_stream_p << name <<
" = ";
1183 printFunctionObject(*d_stream_p,
1189template <
class TYPE>
1195 *d_stream_p << name <<
" = ";
1199 *d_stream_p <<
"NULL";
1200 if (d_spacesPerLevel >= 0) {
1201 *d_stream_p <<
'\n';
1214void Printer::printOrNull<const void *>(
const void *
const& address,
1215 const char *name)
const
1220 *d_stream_p << name <<
" = ";
1222 const void *temp = address;
1232void Printer::printOrNull<void *>(
void *
const& address,
const char *name)
const
1234 const void *
const& temp = address;
1238template <
class TYPE>
1250template <
class ITERATOR>
1252 const ITERATOR& end)
const
1263template <
class ITERATOR,
class PRINT_FUNCTOR>
1265 const ITERATOR& end,
1266 const PRINT_FUNCTOR& printFunctionObject)
const
1274 printFunctionObject,
1289template <
class ITERATOR>
1292 const ITERATOR& begin,
1293 const ITERATOR& end,
1295 const int spacesPerLevel)
1299 for (ITERATOR it = begin; end != it; ++it) {
1305template <
class ITERATOR,
class PRINT_FUNCTOR>
1308 const ITERATOR& begin,
1309 const ITERATOR& end,
1310 const PRINT_FUNCTOR& printFunctionObject,
1312 const int spacesPerLevel)
1316 for (ITERATOR it = begin; end != it; ++it) {
1317 printFunctionObject(stream,
1321 if (spacesPerLevel >= 0) {
1330template <
class TYPE>
1339 if (spacesPerLevel >= 0) {
1344template <
class TYPE>
1361template <
class TYPE>
1364 bsl::ostream& stream,
1374 reinterpret_cast<const void *
>(
1382template <
class TYPE>
1391 static_cast<const void *
>(data),
1396 if (spacesPerLevel >= 0) {
1406template <
class TYPE>
1426 bsl::ostream& stream,
1439template <
class TYPE>
1442 bsl::ostream& stream,
1457template <
class T1,
class T2>
1472#ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_TUPLE
1473template <
class t_TUPLE>
1475void Printer_Helper::printTupleElements(
Printer&,
1481template <
int t_SIZE,
class t_TUPLE>
1483void Printer_Helper::printTupleElements(Printer& printer,
1484 const t_TUPLE& data,
1488 printer.printValue(bsl::get<t_SIZE-1>(data));
1491template <
class... t_TYPES>
1494 const bsl::tuple<t_TYPES...>& data,
1506template <
class TYPE>
1515 static_cast<const void *
>(data.get()),
1523 else if (spacesPerLevel >= 0) {
1528template <
class TYPE>
1536 if (data.has_value()) {
1540 if (spacesPerLevel >= 0) {
1549template <
class TYPE>
1557 data.print(stream, level, spacesPerLevel);
1564template <
class TYPE>
Definition bslstl_stringview.h:471
Definition bslstl_string.h:1252
Definition bslstl_optional.h:2043
Definition bslstl_pair.h:1280
Definition bslstl_sharedptr.h:1838
Definition bslim_printer.h:604
int spacesPerLevel() const
void printOrNull(const TYPE &address, const char *name) const
Definition bslim_printer.h:1190
void printValue(const TYPE &data) const
Definition bslim_printer.h:1240
void printForeign(const TYPE &data, const PRINT_FUNCTOR &printFunctionObject, const char *name) const
Definition bslim_printer.h:1173
void printHexAddr(const void *address, const char *name) const
void end(bool suppressBracket=false) const
~Printer()
Destroy this Printer object.
void start(bool suppressBracket=false) const
void print(const TYPE &data, const char *name) const
Definition bslim_printer.h:1108
void printEndIndentation() const
Printer(bsl::ostream *stream, int level, int spacesPerLevel)
void printAttribute(const bslstl::StringRef &name, const TYPE &data) const
Definition bslim_printer.h:1124
bool suppressInitialIndentFlag() const
void printIndentation() const
Definition bslstl_stringref.h:374
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bslim_formatguard.h:120
Definition bslmf_integralconstant.h:261
Definition bslmf_isarray.h:168
Definition bslmf_isenum.h:272
Definition bslmf_isfundamental.h:330
Definition bslmf_ispointer.h:138
Definition bslalg_hasstliterators.h:99
Definition bslim_printer.h:903
static void printRaw(bsl::ostream &stream, const bslstl::StringRef &data, int level, int spacesPerLevel, bslmf::SelectTraitCase<>)
static void printRaw(bsl::ostream &stream, const bsl::string_view &data, int level, int spacesPerLevel, bslmf::SelectTraitCase<>)
static void printRaw(bsl::ostream &stream, const void *data, int level, int spacesPerLevel, bslmf::SelectTraitCase< bsl::is_pointer >)
static void printRaw(bsl::ostream &stream, const char *data, int level, int spacesPerLevel, bslmf::SelectTraitCase< bsl::is_pointer >)
static void printRaw(bsl::ostream &stream, char data, int level, int spacesPerLevel, bslmf::SelectTraitCase< bsl::is_fundamental >)
static void printRaw(bsl::ostream &stream, unsigned char data, int level, int spacesPerLevel, bslmf::SelectTraitCase< bsl::is_fundamental >)
static void print(bsl::ostream &stream, const TYPE &data, int level, int spacesPerLevel)
Definition bslim_printer.h:1566
static void printRaw(bsl::ostream &stream, bool data, int level, int spacesPerLevel, bslmf::SelectTraitCase< bsl::is_fundamental >)
Definition bslmf_functionpointertraits.h:163
Definition bslmf_selecttrait.h:438
Definition bslmf_selecttrait.h:524
std::size_t UintPtr
Definition bsls_types.h:128