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< uint8_t > > | UniquePtrType |
The typedefed UniquePtr to a uint8_t array. More... | |
typedef UniquePtr< char[], ReallocDeleter< char > > | CharPtrType |
The typedefed UniquePtr to a char array. | |
![]() | |
enum | BufferingMode { BUFFERINGMODE_BLOCKBUFFERED = 0, BUFFERINGMODE_LINEBUFFERED, BUFFERINGMODE_UNBUFFERED } |
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... | |
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... | |
bool | ReleaseAsCstring (CharPtrType *ptr) noexcept |
Closes a stream after adding 0 and moves the string that was written to the stream to ptr. More... | |
Basic Member Functions | |
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... | |
bool | IsOk () const noexcept |
Checks that no error has occurred. More... | |
BufferingMode | GetBufferingMode () const noexcept |
Gets the buffering mode. | |
operator bool () const | |
Returns true if no internal error has occurred. | |
constexpr | OutputStream () noexcept |
Instantiates the object with default parameters (default constructor). | |
virtual | ~OutputStream () noexcept |
Destructor. Does not do anything. | |
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 60 of file ReallocOutputStream.h.
The typedefed UniquePtr
to a uint8_t
array.
free
function when the destructor is started. Definition at line 64 of file ReallocOutputStream.h.
|
explicitnoexcept |
Specifies a realloc
function and instantiates an object.
[in] | func | The function that performs the realloc operation. |
|
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 72 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 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.
|
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 75 of file ReallocOutputStream.h.
|
inlinenoexcept |
Makes the buffer size fit to the current write position.
Release
and ReleaseAsCstring
functions execute. Definition at line 76 of file ReallocOutputStream.h.
© 2013, 2014, 2015 Nintendo Co., Ltd. All rights reserved.