[#BloombergLP-bdlb-OptionalPrinter] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::OptionalPrinter :relfileprefix: ../../ :mrdocs: Utility for printing `bsl::optional` to standard output streams. This class has `operator<<` defined for it, so it can be used, for example, in `ball` logs. == Synopsis Declared in `<bdlb_optionalprinter.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class TYPE> class OptionalPrinter; ---- == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/OptionalPrinter/2constructor.adoc[`OptionalPrinter`] [.small]#[constructor]# | Create `OptionalPrinter` with the specified `data`. | xref:BloombergLP/bdlb/OptionalPrinter/print.adoc[`print`] | Format this object to the specified output `stream` at the (absolute value of) the optionally specified indentation `level` and return a reference to `stream`. If `level` is specified, optionally specify `spacesPerLevel`, the number of spaces per indentation level for this and all of its nested objects. If `level` is negative, suppress indentation of the first line. If `spacesPerLevel` is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by `level`). If `stream` is not valid on entry, this operation has no effect. | xref:BloombergLP/bdlb/OptionalPrinter/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<OptionalPrinter, EnableStreamedFormatter>`] | Declare that this type enables the streamed formatter. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#