[#BloombergLP-balxml-Formatter_CompactImplUtil-addComment]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/balxml.adoc[balxml]::xref:BloombergLP/balxml/Formatter_CompactImplUtil.adoc[Formatter&lowbar;CompactImplUtil]::addComment
:relfileprefix: ../../../
:mrdocs:

Write the specified `comment` into the specified `stream`&period;

== Synopsis

Declared in `&lt;balxml&lowbar;formatter&lowbar;compactimpl&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
std::ostream&
addComment(
    std::ostream& stream,
    xref:BloombergLP/balxml/Formatter_CompactImplUtil/State.adoc[State]* state,
    std::string&lowbar;view const& comment,
    bool forceNewline = true);
----

== Description

Formatting depends on the specified `state`, and the `state` is updated accordingly&period; Return the `stream`&period; The optionally specified `forceNewline`, if true, forces to start a new line solely for the comment if it&apos;s not on a new line already&period; Otherwise, comments continue on current line&period; If an element&hyphen;opening tag is not completed with a `&gt;`, `addComment` will add `&gt;`&period;

DEPRECATED&colon; Use `addValidComment` instead&period;

== Return Value

a reference to the modifiable `stream`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *stream*
| output stream
| *state*
| formatter state to consult and update
| *comment*
| comment text to write
| *forceNewline*
| if `true`, start the comment on a new line
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
