nlib
|
The class for file output streams. More...
#include "nn/nlib/FileOutputStream.h"
Public Member Functions | |
errno_t | Init () noexcept |
Initializes the stream with the default settings. More... | |
NLIB_CHECK_RESULT errno_t | Init (const FileOutputStreamSettings &settings) noexcept |
Initializes a stream. More... | |
NLIB_CHECK_RESULT errno_t | Open (const char *filename, int flags, int mode) noexcept |
Opens the file in write mode. More... | |
NLIB_CHECK_RESULT errno_t | Open (const wchar_t *filename, int flags, int mode) noexcept |
Opens the file in write mode. More... | |
NLIB_CHECK_RESULT errno_t | FdOpen (nlib_fd fd) noexcept |
Makes an already-open file available for use by FileOutputStream . More... | |
nlib_fd | GetFd () const noexcept |
Returns the file descriptor. More... | |
Basic Member Functions | |
FileOutputStream () noexcept | |
Instantiates the object with default parameters (default constructor). The buffer must be set and initialized by the Init function ahead of time. | |
virtual | ~FileOutputStream () noexcept final override |
Destructor. Closes the file if it is open. | |
![]() | |
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 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 | |
![]() | |
enum | BufferingMode { BUFFERINGMODE_BLOCKBUFFERED = 0, BUFFERINGMODE_LINEBUFFERED, BUFFERINGMODE_UNBUFFERED } |
The buffering mode for OutputStream . More... | |
![]() | |
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 file output streams.
Definition at line 21 of file FileOutputStream.h.
|
noexcept |
Makes an already-open file available for use by FileOutputStream
.
[in] | fd | An already-open nlib_fd -type value. |
0
on success. Any other value indicates an error.Init
function was not called ahead of time, it is called internally here.
|
inlinenoexcept |
Returns the file descriptor.
Definition at line 50 of file FileOutputStream.h.
|
inlinenoexcept |
Initializes the stream with the default settings.
0
on success. Any other value indicates an error.FileOutputStream
object is allocated from the heap in the default size. Definition at line 28 of file FileOutputStream.h.
|
noexcept |
Initializes a stream.
[in] | settings | The default options. |
0
on success. Any other value indicates an error.
|
noexcept |
Opens the file in write mode.
[in] | filename | The path to the file. |
[in] | flags | Flags to be passed to nlib_fd_open() for opening files (NLIB_FD_O_WRONLY | NLIB_FD_O_CREAT | NLIB_FD_O_TRUNC , if they are omitted). |
[in] | mode | A permission argument to be passed to nlib_fd_open() (0644 if it is omitted). |
0
on success. Any other value indicates an error.Init
function was not called ahead of time, it is called internally here.
|
noexcept |
Opens the file in write mode.
[in] | filename | The path to the file. |
[in] | flags | Flags to be passed to nlib_fd_open() for opening files (NLIB_FD_O_WRONLY | NLIB_FD_O_CREAT | NLIB_FD_O_TRUNC , if they are omitted). |
[in] | mode | A permission argument to be passed to nlib_fd_open() (0644 if it is omitted). |
0
on success. Any other value indicates an error.Init
function was not called ahead of time, it is called internally here. © 2012-2016 Nintendo Co., Ltd. All rights reserved.