Wraps a SC::FileDescriptor to open it and use strings / containers. More...
#include <File.h>
Classes | |
struct | OpenOptions |
Additional flags to be set when opening files. More... | |
Public Types | |
enum | OpenMode { ReadOnly , WriteCreateTruncate , WriteAppend , ReadAndWrite } |
Define mode for opening the file (read, write etc.) More... | |
Public Member Functions | |
File (FileDescriptor &descriptor) | |
Result | open (StringView path, OpenMode mode) |
Opens file at path with a given mode More... | |
Result | open (StringView path, OpenMode mode, OpenOptions options) |
Opens file at path with a given mode More... | |
Result | readUntilEOF (Vector< char > &destination) |
Reads into a given dynamic buffer until End of File (EOF) is signaled. More... | |
Result | readUntilEOF (Vector< uint8_t > &destination) |
Reads into a given dynamic buffer until End of File (EOF) is signaled. More... | |
Result | readUntilEOF (String &destination) |
Reads into a given string until End of File (EOF) is signaled It works also for non-seekable file descriptors (stdout / in / err). More... | |
Public Attributes | |
FileDescriptor & | fd |
Wraps a SC::FileDescriptor to open it and use strings / containers.
Example usage:
enum SC::File::OpenMode |
Define mode for opening the file (read, write etc.)
Result SC::File::open | ( | StringView | path, |
OpenMode | mode | ||
) |
Opens file at path
with a given mode
path | The path to file |
mode | The mode used to open file (read-only, write-append etc.) |
Result SC::File::open | ( | StringView | path, |
OpenMode | mode, | ||
OpenOptions | options | ||
) |
Opens file at path
with a given mode
path | The path to file |
mode | The mode used to open file |
options | Options that can be applied when opening the file (inheritable, blocking etc.) |
Reads into a given string until End of File (EOF) is signaled It works also for non-seekable file descriptors (stdout / in / err).
destination | A destination string to write to (it will be sized as needed) |
Reads into a given dynamic buffer until End of File (EOF) is signaled.
It works also for non-seekable file descriptors (stdout / in / err).
destination | A destination buffer to write to (it will be resized as needed) |
Reads into a given dynamic buffer until End of File (EOF) is signaled.
It works also for non-seekable file descriptors (stdout / in / err).
destination | A destination buffer to write to (it will be resized as needed) |