[#BloombergLP-bslim-Printer] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslim.adoc[bslim]::Printer :relfileprefix: ../../ :mrdocs: This class implements a _mechanism_ used to format data as required by the standard BDE `print` method contract. == Synopsis Declared in `<bslim_printer.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class Printer; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslim/Printer/2constructor.adoc[`Printer`] [.small]#[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. | xref:BloombergLP/bslim/Printer/2destructor.adoc[`~Printer`] [.small]#[destructor]# | Destroy this `Printer` object. | xref:BloombergLP/bslim/Printer/absLevel.adoc[`absLevel`] | Return the absolute value of the formatting level supplied at construction. | xref:BloombergLP/bslim/Printer/end.adoc[`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. | xref:BloombergLP/bslim/Printer/print.adoc[`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`: | xref:BloombergLP/bslim/Printer/printAttribute-0e.adoc[`printAttribute`] | `printAttribute` overloads | xref:BloombergLP/bslim/Printer/printEndIndentation.adoc[`printEndIndentation`] | Print to the output stream supplied at construction `absLevel() * spacesPerLevel()` blank spaces if `spacesPerLevel() >= 0`, and print a single blank space otherwise. | xref:BloombergLP/bslim/Printer/printForeign.adoc[`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) ` | xref:BloombergLP/bslim/Printer/printHexAddr.adoc[`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. | xref:BloombergLP/bslim/Printer/printIndentation.adoc[`printIndentation`] | Print to the output stream supplied at construction `(absLevel() + 1) * spacesPerLevel()` blank spaces if `spacesPerLevel() >= 0`, and print a single blank space otherwise. | xref:BloombergLP/bslim/Printer/printOrNull-0bc.adoc[`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. | xref:BloombergLP/bslim/Printer/printValue-0e.adoc[`printValue`] | `printValue` overloads | xref:BloombergLP/bslim/Printer/spacesPerLevel.adoc[`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. | xref:BloombergLP/bslim/Printer/start.adoc[`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. | xref:BloombergLP/bslim/Printer/suppressInitialIndentFlag.adoc[`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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#