class text_output_stream


template <
    typename OutputResource
>
class text_output_stream
    : public output_stream<OutputResource>

Description

A text output stream is an object that allows you to write text to an output resource.

Public Aliases

using referenced_resource_type = OutputResource

The type of the referenced output resource.

Public Member Functions

text_output_stream (
    referenced_resource_type& resource,
    encoding_form target_encoding_form,
    std::endian endianness = std::endian::big
)
noexcept

Constructs a text output stream from the given output resource and with the given encoding form and endianness. The text output stream will hold a non-owning reference to the resource, which is expected to stay valid when using the text output stream.

Parameters:
  • resource:

    The output resource to write to.

  • target_encoding_form:

    The encoding form that the text is going to be in.

  • endianness:

    The endianness that the text is going to be in.

text_output_stream (
    const text_output_stream& other
)

Copy-constructs a text_output_stream from an existing one.

Parameters:
  • other:

    The text_output_stream to copy from.

text_output_stream&
operator = (
    const text_output_stream& other
)

Copy-assigns a text_output_stream into this one.

Parameters:
  • other:

    The text_output_stream to copy from.

text_output_stream (
    text_output_stream&& other
)
noexcept

Move-constructs a text_output_stream from an existing one.

Parameters:
  • other:

    The text_output_stream to move from.

text_output_stream&
operator = (
    text_output_stream&& other
)
noexcept

Move-assigns a text_output_stream into this one.

Parameters:
  • other:

    The text_output_stream to move from.

encoding_form
get_encoding_form ()
const noexcept

Returns the encoding form associated with this text output stream.

void
set_encoding_form (
    encoding_form new_target_encoding_form
)
noexcept

Sets the encoding form associated with this text output stream.

Parameters:
  • new_target_encoding_form:

    The new encoding form to use with this text output stream.

void
write_bom ()

Writes a BOM (byte order mark) for the current endianness in the current encoding form.



Copyright © 2022-2025 Daniel T. McGinnis

CCL was first published in 2022, and is still actively maintained.

This website was first published in 2022, and is still actively maintained.

This specific web page was first published in 2023.