Format to the output stream supplied at construction the specified data, prefixed by the specified name. Format data based on the parameterized TYPE:

Synopsis

Declared in <bslim_printer.h>

template<class TYPE>
void
printAttribute(
    bslstl::StringRef const& name,
    TYPE const& data) const;

Description

* If TYPE is a fundamental type, output data to the stream. * If TYPE is a fixed length array (Element[NUM]) and not a char array, print out all the elements of the array. * If TYPE is void * or `const void *', or function pointer, print the address value of `data in hexadecimal format if it is not 0, and print the string "NULL" otherwise. * If TYPE is char *, const char *, char [], or 'const char [] or bsl::string print data to the stream as a null‐terminated C‐style string enclosed in quotes if data is not 0, and print the string "NULL" otherwise. * If TYPE is a pointer type (other than the, potentially const‐qualified, char * or void *), print the address value of data in hexadecimal format, then format the object at that address if data is not 0, and print the string "NULL" otherwise. There will be a compile‐time error if data is a pointer to a user‐defined type that does not provide a standard print method. * If TYPE is a bsl::pair object, print out the two elements of the pair. * If TYPE is a bslstl::StringRef object, print the referenced string enclosed in quotes (possibly including embedded 0s). * If TYPE has STL iterators (this includes all STL sequence and associative containers: vector, deque, list, set, map, multiset, multimap, unordered_set, unordered_map, unordered_multiset, and unordered_multimap), print all the objects in the container. * If TYPE is any other type, call the standard print method on data, specifying one additional level of indentation than the current one. There will be a compile‐time error if TYPE does not provide a standard print method.

If spacesPerLevel() < 0, format data on a single line. Otherwise, indent data by (absLevel() + 1) * spacesPerLevel() blank spaces. The behavior is undefined if TYPE is a char *, but not a null‐terminated string.

Created with MrDocs