|
Monero
|
A partial drop-in replacement for std::ostream. More...
#include <byte_stream.h>
Public Types | |
| using | char_type = std::uint8_t |
| using | Ch = char_type |
| using | value_type = char_type |
Public Member Functions | |
| byte_stream () noexcept | |
| Increase internal buffer by at least byte_stream_increase bytes. | |
| byte_stream (byte_stream &&rhs) noexcept | |
| ~byte_stream () noexcept=default | |
| byte_stream & | operator= (byte_stream &&rhs) noexcept |
| std::uint8_t * | data () noexcept |
| const std::uint8_t * | data () const noexcept |
| std::uint8_t * | tellp () const noexcept |
| std::size_t | available () const noexcept |
| std::size_t | size () const noexcept |
| std::size_t | capacity () const noexcept |
| void | Flush () const noexcept |
| Compatibility with rapidjson. | |
| void | reserve (const std::size_t more) |
| void | clear () noexcept |
| Reset write position, but do not release internal memory. | |
| void | write (const std::uint8_t *ptr, const std::size_t length) |
| void | write (const char *ptr, const std::size_t length) |
| void | write (const epee::span< const std::uint8_t > source) |
| void | write (const epee::span< const char > source) |
| void | put (const std::uint8_t ch) |
| void | Put (const std::uint8_t ch) |
| void | put_unsafe (const std::uint8_t ch) noexcept |
| void | put_n (const std::uint8_t ch, const std::size_t count) |
| void | push_back (const std::uint8_t ch) |
| byte_buffer | take_buffer () noexcept |
Private Member Functions | |
| void | overflow (const std::size_t requested) |
| End of buffer. | |
| void | check (const std::size_t requested) |
| Ensures that at least requested bytes are available. | |
Private Attributes | |
| byte_buffer | buffer_ |
| std::uint8_t * | next_write_ |
| Beginning of buffer. | |
| const std::uint8_t * | end_ |
| Current write position. | |
A partial drop-in replacement for std::ostream.
Only a few base std::ostream functions are implemented - enough for rapidjson output currently.
Advantages over std::stringstream or rapidjson::StringBuffer:
| using epee::byte_stream::Ch = char_type |
| using epee::byte_stream::char_type = std::uint8_t |
|
inlinenoexcept |
Increase internal buffer by at least byte_stream_increase bytes.
|
noexcept |
|
defaultnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlineprivate |
Ensures that at least requested bytes are available.
|
inlinenoexcept |
Reset write position, but do not release internal memory.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Compatibility with rapidjson.
|
noexcept |
|
private |
End of buffer.
|
inline |
Copy ch to end of stream.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
|
inline |
Copy ch to end of stream. Provides rapidjson compatability.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
|
inline |
Copy ch to end of stream.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
Write ch to end of stream count times.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
|
inlinenoexcept |
|
inline |
Reserve at least more bytes.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
|
inlinenoexcept |
|
noexcept |
|
inlinenoexcept |
Copy length bytes starting at ptr to end of stream.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
|
inline |
Copy source to end of stream.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
|
inline |
Copy source to end of stream.
| std::range_error | if exceeding max size_t value. |
| std::bad_alloc | if allocation fails. |
Copy length bytes starting at ptr to end of stream.
| std::range_error | If exceeding max size_t value. |
| std::bad_alloc | If allocation fails. |
|
private |
|
private |
Current write position.
|
private |
Beginning of buffer.