8#ifndef INCLUDED_BDLB_PRINTMETHODS
9#define INCLUDED_BDLB_PRINTMETHODS
257#include <bdlscm_version.h>
269#include <bsl_iomanip.h>
270#include <bsl_ostream.h>
271#include <bsl_vector.h>
273#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
278#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
285template <
class CHAR_TYPE,
class CHAR_TRAITS,
class ALLOCATOR>
324 template <
class TYPE>
330 template <
class TYPE>
340namespace PrintMethods {
352bsl::ostream&
print(bsl::ostream& stream,
355 int spacesPerLevel = 4);
356bsl::ostream&
print(bsl::ostream& stream,
359 int spacesPerLevel = 4);
360bsl::ostream&
print(bsl::ostream& stream,
361 unsigned char object,
363 int spacesPerLevel = 4);
369template <
class CHAR_T,
class CHAR_TRAITS_T,
class ALLOC>
370bsl::ostream&
print(bsl::ostream& stream,
375 int spacesPerLevel = 4);
383template <
class ALLOC>
384bsl::ostream&
print(bsl::ostream& stream,
387 int spacesPerLevel = 4);
389#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
403bsl::ostream&
print(bsl::ostream& stream,
404 const std::optional<TYPE>&
object,
406 int spacesPerLevel = 4);
421template <
class ... TYPE>
422bsl::ostream&
print(bsl::ostream& stream,
423 const std::variant<TYPE ...>&
object,
425 int spacesPerLevel = 4);
438bsl::ostream&
print(bsl::ostream& stream,
439 const std::monostate&
object,
441 int spacesPerLevel = 4);
458template <
class TYPE,
class SELECTOR>
473 static bsl::ostream& print(bsl::ostream& stream,
492 static bsl::ostream& print(bsl::ostream& stream,
511 static bsl::ostream& print(bsl::ostream& stream,
529 static bsl::ostream& print(bsl::ostream& stream,
546 bsl::ostream& stream,
562 if (0 <= spacesPerLevel) {
577 print(bsl::ostream& stream,
585 return object.print(stream, level, spacesPerLevel);
596 >::print(bsl::ostream& stream,
610 typedef typename TYPE::const_iterator Iterator;
612 if (0 <= spacesPerLevel) {
621 const int levelPlus1 = level + 1;
623 for (Iterator it =
object.begin(); it !=
object.end(); ++it) {
639 for (Iterator it =
object.begin(); it !=
object.end(); ++it) {
647 return stream << bsl::flush;
657 print(bsl::ostream& stream,
668 if (0 <= spacesPerLevel) {
677 const int levelPlus1 = level + 1;
710 return stream << bsl::flush;
735template <
class CHAR_T,
class CHAR_TRAITS_T,
class ALLOC>
737 bsl::ostream& stream,
749template <
class ALLOC>
764 const int len =
static_cast<int>(
object.size());
772 if (0 <= spacesPerLevel) {
779#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_BASELINE_LIBRARY
784 const std::optional<TYPE>&
object,
789 if (
object.has_value()) {
803template <
class ... TYPE>
806 const std::variant<TYPE ...>&
object,
810 const auto lambda = [&](
const auto& x) -> bsl::ostream& {
816 return std::visit(lambda,
object);
822 const std::monostate& ,
Definition bslstl_string.h:1281
Definition bslstl_vector.h:1025
Definition bslmf_nestedtraitdeclaration.h:214
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
bsl::ostream & print(bsl::ostream &stream, const TYPE &object, int level=0, int spacesPerLevel=4)
Definition bdlb_printmethods.h:719
Definition bdlb_algorithmworkaroundutil.h:74
Definition bdlb_printmethods.h:283
Definition bdlbb_blob.h:576
Definition bdlb_printmethods.h:306
Definition bdlb_printmethods.h:459
static bsl::ostream & indent(bsl::ostream &stream, int level, int spacesPerLevel=4)
static bsl::ostream & printString(bsl::ostream &stream, const char *string, int length, bool escapeBackSlash=false)
Definition bdlb_printmethods.h:327
Definition bdlb_printmethods.h:320
Definition bslalg_hasstliterators.h:99
Definition bslmf_detectnestedtrait.h:464
Definition bslmf_ispair.h:88
Definition bslmf_selecttrait.h:438
Definition bslmf_selecttrait.h:522