class text_input_stream


template <
    typename InputResource
>
class text_input_stream
    : public input_stream<InputResource>

Public Aliases

using wrapped_resource_type = InputResource

The type of the wrapped input resource.

Public Member Functions

text_input_stream (
    wrapped_resource_type& resource,
    encoding_form source_encoding_form,
    std::endian endianness = std::endian::big
)
noexcept

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

Parameters:
  • resource:

    The input resource to read from.

  • source_encoding_form:

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

  • endianness:

    The endianness that the text is expected to be in.

encoding_form
get_encoding_form ()
const noexcept

Returns the encoding form associated with this text input stream.

void
set_encoding_form (
    encoding_form new_source_encoding_form
)
noexcept

Sets the encoding form associated with this text input stream.

Parameters:
  • new_source_encoding_form:

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

char32_t
read_bom ()

Reads a code point in the current encoding form, and if it is a valid BOM (byte order mark) then the endianness of this text input stream is adjusted accordingly. Returns the read code point.

template <
    writable_unicode_string TargetString
>
void
append_line (
    TargetString& target
)

Reads a line and appends it to the given string object.

Parameters:
  • target:

    The object to append the read line to.

template <
    writable_unicode_string TargetString
>
void
read_line (
    TargetString& target
)

Reads a line and assigns it to the given string object.

Parameters:
  • target:

    The object to assign the read line to.

template <
    writable_unicode_string TargetString
>
void
append_all (
    TargetString& target
)

Reads all remaining text and appends it to the given string object.

Parameters:
  • target:

    The object to append the read text to.

template <
    writable_unicode_string TargetString
>
void
read_all (
    TargetString& target
)

Reads all remaining text and assigns it to the given string object.

Parameters:
  • target:

    The object to assign the read text to.



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 2022.