BloombergLP::bslim::Printer

This class implements a mechanism used to format data as required by the standard BDE print method contract.

Synopsis

Declared in <bslim_printer.h>

class Printer;

Member Functions

NameDescription
Printer [constructor]Create a Printer object that will print to the specified stream in a format dictated by the values of the specified level and spacesPerLevel, as per the contract of the standard BDE print method. The behavior is undefined unless stream is valid.
~Printer [destructor]Destroy this Printer object.
absLevel Return the absolute value of the formatting level supplied at construction.
end If spacesPerLevel() >= 0, print a newline character to the output stream supplied at construction. If the optionally specified suppressBracket is false, print a closing square bracket, indented by absLevel() * spacesPerLevel() blank spaces.
print Format to the output stream supplied at construction the specified data, prefixed by the specified name if name is not 0. Format data based on the parameterized TYPE:
printAttribute printAttribute overloads
printEndIndentation Print to the output stream supplied at construction absLevel() * spacesPerLevel() blank spaces if spacesPerLevel() >= 0, and print a single blank space otherwise.
printForeign Print to the output stream supplied at construction the specified name, if name is not 0, and then call the specified printFunctionObject with the specified data, the stream supplied at construction, absLevel() + 1, and spacesPerLevel(). The parameterized PRINT_FUNCTOR must be an invocable type whose arguments match the following function signature: ` bsl::ostream& (*)(bsl::ostream& stream, const TYPE& data, int level, int spacesPerLevel) `
printHexAddr Write to the output stream supplied at construction the specified address in a hexadecimal format, if address is not 0, and print the string "NULL" otherwise, prefixed by the specified name if name is not 0. If spacesPerLevel() < 0, print on a single line. If spacesPerLevel() >= 0, indent by (absLevel() + 1) * spacesPerLevel() blank spaces.
printIndentation Print to the output stream supplied at construction (absLevel() + 1) * spacesPerLevel() blank spaces if spacesPerLevel() >= 0, and print a single blank space otherwise.
printOrNull Format to the output stream supplied at construction the object at the specified address, if address is not 0, and print the string "NULL" otherwise, prefixed by the specified name if name is not 0. If spacesPerLevel() < 0, print on a single line. If spacesPerLevel() >= 0, indent by (absLevel() + 1) * spacesPerLevel() blank spaces. The behavior is undefined unless TYPE is a pointer type.
printValue printValue overloads
spacesPerLevel Return the number of whitespace characters to output for each level of indentation. The number of whitespace characters for each level of indentation is configured using the spacesPerLevel supplied at construction.
start Print to the output stream supplied at construction absLevel() * spacesPerLevel() blank spaces if the suppressInitialIndentFlag is false, and suppress the initial indentation otherwise. If the optionally specified suppressBracket is false, print an opening square bracket.
suppressInitialIndentFlag Return true if the initial output indentation will be suppressed, and false otherwise. The initial indentation will be suppressed if the level supplied at construction is negative.