|
|
template<std::contiguous_iterator Iterator>
requires std::is_same_v<std::iter_value_t<Iterator>, StorageElement> |
| MemoryOutputStream (Iterator begin, Iterator end) |
| Constructs a stream that writes to a memory region defined by a pair of iterators.
|
|
template<std::contiguous_iterator Iterator>
requires std::is_same_v<std::iter_value_t<Iterator>, StorageElement> |
| MemoryOutputStream (Iterator begin, std::iter_difference_t< Iterator > size) |
| Constructs a stream that writes to a memory region defined by an iterator and a size.
|
|
template<std::ranges::contiguous_range Region>
requires std::is_same_v<std::ranges::range_value_t<Region>, StorageElement> |
| MemoryOutputStream (Region ®ion) |
| Constructs a stream that writes to a memory region.
|
|
|
auto | at (size_type index) const -> const_reference |
| Accesses the element at a certain index.
|
|
auto | operator[] (size_type index) const noexcept -> const_reference |
| Subscript operator.
|
|
auto | front () const noexcept -> const_reference |
| Returns the first element.
|
|
auto | back () const noexcept -> const_reference |
| Returns the last element.
|
|
auto | data () const noexcept -> const value_type * |
| Raw access to the data.
|
|
template<typename CharTraits = std::char_traits<StorageElement>>
requires tools::CharType<StorageElement> |
| operator std::basic_string_view< StorageElement, CharTraits > () const |
| Returns the data written so far as a string view.
|
|
|
auto | begin () const noexcept -> const_iterator |
| Creates a begin iterator.
|
|
auto | cbegin () const noexcept -> const_iterator |
| Creates a begin iterator.
|
|
auto | end () const noexcept -> const_iterator |
| Creates an end iterator.
|
|
auto | cend () const noexcept -> const_iterator |
| Creates an end iterator.
|
|
auto | rbegin () const noexcept -> const_reverse_iterator |
| Creates a reverse begin iterator.
|
|
auto | crbegin () const noexcept -> const_reverse_iterator |
| Creates a reverse begin iterator.
|
|
auto | rend () const noexcept -> const_reverse_iterator |
| Creates a reverse end iterator.
|
|
auto | crend () const noexcept -> const_reverse_iterator |
| Creates a reverse end iterator.
|
|
auto | empty () const noexcept -> bool |
| Determines whether the data is empty.
|
|
auto | size () const noexcept -> size_type |
| Gets the size of the data.
|
|
auto | capacity () const noexcept -> size_type |
| Gets the capacity of the data.
|
|
virtual | ~OutputStream () noexcept(false)=0 |
| Virtual, throwing destructor.
|
|
auto | write (Element element) -> void |
| Write a single element to the stream.
|
|
template<std::ranges::contiguous_range Data>
requires std::same_as<std::remove_cv_t<std::ranges::range_value_t<Data>>, Element> |
auto | write (const Data &data) -> void |
| Write a block of data.
|
|
template<std::size_t kDataSize> |
auto | write (const Element(&data)[kDataSize]) -> void |
| Write a block of data contained in an array.
|
|
template<std::contiguous_iterator Iterator, std::sized_sentinel_for< Iterator > Sentinel>
requires std::same_as<std::remove_cv_t<std::iter_value_t<Iterator>>, Element> |
auto | write (Iterator first, Sentinel last) -> void |
| Write a block of data contained in an iterator range.
|
|
auto | write (const Element *data, std::size_t size) -> void |
| Write a block of data contained in a region of memory.
|
|
auto | write (const Element *nullTerminatedString) -> void |
| Write a NULL-teminated string.
|
|
auto | flush () -> void |
| Flushes the buffer.
|
|
virtual | ~StreamBase () noexcept(false)=0 |
| Virtual, throwing destructor.
|
|
auto | streamDescription () const -> std::string |
| Get a description of the device.
|
|
|
| OutputStream () noexcept=default |
| Default constructor.
|
|
| OutputStream (Element *bufferBegin, Element *bufferEnd) noexcept |
| Constructor that sets an initially empty buffer.
|
|
| OutputStream (Element *bufferBegin, Element *bufferEnd, Element *dataEnd) noexcept |
| Constructor that sets a buffer that possibly already contains some data.
|
|
| OutputStream (OutputStream &&other) noexcept |
| Move constructor.
|
|
auto | operator= (OutputStream &&rhs) noexcept -> OutputStream & |
| Move assignemnt operator.
|
|
auto | setWriteBuffer (Element *bufferBegin, Element *bufferEnd) noexcept -> void |
| Sets a new empty buffer.
|
|
auto | setWriteBuffer (Element *bufferBegin, Element *bufferEnd, Element *dataEnd) noexcept -> void |
| Sets the buffer.
|
|
auto | setWriteDataEnd (Element *dataEnd) noexcept -> void |
| Sets the end of the data within the buffer.
|
|
auto | writeBufferBegin () const -> Element * |
| Writes back the buffer start position.
|
|
auto | writeBufferEnd () const -> Element * |
| Writes back the buffer end position.
|
|
auto | writeBufferSize () const -> std::size_t |
| Gets the buffer size.
|
|
auto | writeDataBegin () const -> Element * |
| Returns the beginning of data in the buffer.
|
|
auto | writeDataEnd () const -> Element * |
| Returns the end of the data in the buffer.
|
|
auto | writeDataSize () const -> std::size_t |
| Returns the size of the unwritten data in the buffer.
|
|
auto | freeBufferBegin () const -> Element * |
| Returns the beginning of the free region of the buffer.
|
|
auto | freeBufferSize () const -> std::size_t |
| Returns the size of the unwritten data in the buffer.
|
|
virtual auto | doFlushWriteBuffer () -> void |
| Called by the framework to write the buffered data to the underlying device once it is full.
|
|
virtual auto | doWrite (const Element *data, std::size_t size) -> std::size_t=0 |
| Called by the framework to write data from a memory region to the underlying device.
|
|
virtual auto | doGetStreamDescription () const -> std::string=0 |
| Called by the framework to get a description of the stream.
|
|
template<StreamElement Element, typename StorageElement = Element>
class xentara::utils::io::MemoryOutputStream< Element, StorageElement >
A stream that writes data to a memory region.
- Template Parameters
-
Element | The type of elements that will be written to the stream. |
StorageElement | The type for the elements actually contained in the memory region. Must be the same as Element, or another trivial type that is the same size as Element. Common types for byte oriented streams include char, unsigned char. |
- See also
- MemoryOutputStream<Element, void>