class input_stream


template <
    typename InputResource
>
class input_stream

Public Aliases

using wrapped_resource_type = InputResource

The type of the wrapped input resource.

Public Member Functions

explicit
input_stream (
    wrapped_resource_type& resource,
    std::endian endianness = std::endian::native
)
noexcept

Constructs an input stream with the given input resource and endianness.

Parameters:
  • resource:

    The input resource this stream will read from.

  • endianness:

    The endianness the data is expected to be in.

wrapped_resource_type&
grab_resource ()
noexcept

Returns a non-constant reference to the wrapped input resource.

const wrapped_resource_type&
grab_resource ()
const noexcept

Returns a constant reference to the wrapped input resource.

std::endian
get_endianness ()
const noexcept

Returns the endianness associated with this input stream.

void
set_endianness (
    std::endian new_endianness
)
noexcept

Sets the endianness associated with this input stream.

Parameters:
  • new_endianness:

    The new endianness to use with this input stream.

bool
is_at_end ()
const noexcept

Tells whether this stream's input resource is at its end.

std::size_t
read (
    std::byte* data,
    std::size_t byte_count
)

Reads byte_count bytes from this stream's input resource and places them in the provided data array.

Parameters:
  • data:

    The array into which the read bytes will be placed.

  • byte_count:

    The number of bytes to read from this stream's input resource.

wrapped_resource_type*
operator -> ()
const noexcept

Returns a pointer to the wrapped input resource, enabling use of the arrow operator.



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.