class string_io_resource


template <
    writable_unicode_string T
>
class string_io_resource
    : public seekable_io_resource<std::int64_t>

Public Member Functions

explicit
string_io_resource (
    std::size_t buffer_capacity = io_buffer::default_buffer_capacity
)

Constructs a string I/O resource with the given buffer capacity.

Parameters:
  • buffer_capacity:

    The capacity of the I/O buffer. If this is zero, the string I/O resource is completely unbuffered.

explicit
string_io_resource (
    string_type initial_content,
    std::size_t buffer_capacity = io_buffer::default_buffer_capacity
)

Constructs a string I/O resource with the given initial content and buffer capacity.

Parameters:
  • initial_content:

    The content that this string I/O resource will start with.

  • buffer_capacity:

    The capacity of the I/O buffer. If this is zero, the string I/O resource is completely unbuffered.

bool
is_at_end ()
const noexcept override

Returns true if this string I/O resource is at the end of its contained string. Otherwise, returns false.

T&
grab_content ()
noexcept

Returns a non-constant reference to the contained string.

const T&
grab_content ()
const noexcept

Returns a constant reference to the contained string.

std::int64_t
get_position ()
const noexcept override

Returns the position <#/this> string I/O resource is at, that is, the position at which read and write operations will take place next.

Protected Member Functions

void
set_position_raw (
    std::int64_t new_position,
    position_reference pr
)
noexcept override
std::size_t
read_raw (
    std::byte* data,
    std::size_t byte_count,
    read_request rr
)
override

Reads byte_count bytes from this string I/O 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 input resource.

  • rr:

    The kind of read request that is being issued to this string I/O resource.

std::size_t
write_raw (
    const std::byte* data,
    std::size_t byte_count
)
override

Writes byte_count bytes from the data array to this string I/O resource.

Parameters:
  • data:

    The array of bytes that will be written to this string I/O resource.

  • byte_count:

    The number of bytes to write to this string I/O resource.



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.