nlib
|
The class for output streams written to memory expanded using nlib_realloc
or another realloc
function.
More...
#include "nn/nlib/ReallocOutputStream.h"
Public Types | |
typedef UniquePtr< uint8_t[], ReallocDeleter > | UniquePtrType |
The typedefed UniquePtr to a uint8_t array. More... | |
typedef UniquePtr< char[], ReallocDeleter > | CharPtrType |
The typedefed UniquePtr to a char array. | |
![]() | |
enum | BufferingMode { kBufferingModeBlockBuffered = 0, kBufferingModeLineBuffered, kBufferingModeUnbuffered } |
The buffering mode for OutputStream . More... | |
Public Member Functions | |
uint8_t * | Data () noexcept |
Gets the pointer to the start of the data that is in the process of being written. More... | |
const uint8_t * | Data () const noexcept |
The const decoration version of the above function. | |
bool | Reserve (size_t n) noexcept |
Allocates a buffer of the specified size for writing to. More... | |
void | ShrinkToFit () noexcept |
Makes the buffer size fit to the current write position. More... | |
size_t | Release (UniquePtrType *ptr) noexcept |
Closes a stream and moves the data that was written to the stream to ptr. More... | |
std::pair< UniquePtrType, size_t > | Release () noexcept |
Closes a stream and returns the data that was written to the stream. More... | |
bool | ReleaseAsCstring (CharPtrType *ptr) noexcept |
Closes a stream after adding 0 and moves the string that was written to the stream to ptr. More... | |
CharPtrType | ReleaseAsCstring () noexcept |
Closes a stream after adding 0 and returns the string that was written to the stream. More... | |
Constructor, Destructor, and Initialization | |
ReallocOutputStream () noexcept | |
Instantiates the object with default parameters (default constructor). Configures the object to expand memory using the nlib_realloc function. | |
ReallocOutputStream (ReallocFunc func) noexcept | |
Specifies a realloc function and instantiates an object. More... | |
virtual | ~ReallocOutputStream () noexcept override |
Destructor. | |
![]() | |
size_t | Pos () const noexcept |
Returns the current position in the stream. More... | |
uint64_t | Pos64 () const noexcept |
Returns the current position in the stream as a 64-bit integer. More... | |
bool | Write (int b) noexcept |
Writes one byte of data to the stream. More... | |
bool | Write (const void *p, size_t n) noexcept |
Writes n bytes of data to the stream. More... | |
bool | WriteGather (const nlib_fd_iovec *iov, int iovcnt) noexcept |
Writes data from multiple non-continuous buffers to a stream. More... | |
bool | Flush () noexcept |
Flushes the stream. More... | |
bool | Close () noexcept |
Closes the stream after it has been flushed. Returns true if successful. More... | |
errno_t | GetErrorValue () const noexcept |
Gets the error value. More... | |
BufferingMode | GetBufferingMode () const noexcept |
Gets the buffering mode. | |
operator bool () const | |
Returns true if the object has been initialized and an error has not occurred inside, or returns false if an error has occurred inside. | |
constexpr | OutputStream () noexcept |
Instantiates the object with default parameters (default constructor). | |
virtual | ~OutputStream () noexcept |
Destructor. | |
Additional Inherited Members | |
![]() | |
void | ResetBuffer (void *p, size_t nbytes) noexcept |
Sets the buffer held by OutputStream . More... | |
void | SetError (errno_t e) const noexcept |
Sets an error to OutputStream . More... | |
![]() | |
BufferingMode | m_BufferingMode |
Stores the buffering mode. More... | |
The class for output streams written to memory expanded using nlib_realloc
or another realloc
function.
Definition at line 38 of file ReallocOutputStream.h.
The typedefed UniquePtr
to a uint8_t
array.
free
function when the destructor is started. Definition at line 40 of file ReallocOutputStream.h.
|
inlineexplicitnoexcept |
Specifies a realloc
function and instantiates an object.
[in] | func | The function that performs the realloc operation. |
Definition at line 49 of file ReallocOutputStream.h.
|
inlinenoexcept |
Gets the pointer to the start of the data that is in the process of being written.
realloc
operation during writing. Definition at line 54 of file ReallocOutputStream.h.
|
noexcept |
Closes a stream and moves the data that was written to the stream to ptr.
[out] | ptr | Pointer where the data is set. |
|
noexcept |
Closes a stream and returns the data that was written to the stream.
|
noexcept |
Closes a stream after adding 0
and moves the string that was written to the stream to ptr.
[out] | ptr | Pointer where the C string is set. |
true
if the function succeeded and 0
was successfully added.
|
noexcept |
Closes a stream after adding 0
and returns the string that was written to the stream.
0
, it returns an invalid smart pointer.
|
inlinenoexcept |
Allocates a buffer of the specified size for writing to.
[in] | n | The size of the buffer to allocate. |
true
when allocated successfully. Definition at line 57 of file ReallocOutputStream.h.
|
inlinenoexcept |
Makes the buffer size fit to the current write position.
Release
and ReleaseAsCstring
functions execute. Definition at line 58 of file ReallocOutputStream.h.
© Nintendo Co., Ltd. All rights reserved.