HDK
|
#include <filesystem.h>
Public Types | |
enum | Mode { Closed = 0, Read = 'r', Write = 'w' } |
Public Member Functions | |
IOProxy () | |
IOProxy (string_view filename, Mode mode) | |
IOProxy (const std::wstring &filename, Mode mode) | |
virtual | ~IOProxy () |
virtual const char * | proxytype () const =0 |
virtual void | close () |
virtual bool | opened () const |
virtual int64_t | tell () |
virtual bool | seek (int64_t offset) |
virtual size_t | read (void *buf, size_t size) |
virtual size_t | write (const void *buf, size_t size) |
virtual size_t | pread (void *buf, size_t size, int64_t offset) |
virtual size_t | pwrite (const void *buf, size_t size, int64_t offset) |
virtual size_t | size () const |
virtual void | flush () const |
Mode | mode () const |
const std::string & | filename () const |
template<class T > | |
size_t | read (span< T > buf) |
template<class T > | |
size_t | write (span< T > buf) |
size_t | write (string_view buf) |
bool | seek (int64_t offset, int origin) |
std::string | error () const |
void | error (string_view e) |
Protected Attributes | |
std::string | m_filename |
int64_t | m_pos = 0 |
Mode | m_mode = Closed |
std::string | m_error |
Proxy class for I/O. This provides a simplified interface for file I/O that can have custom overrides. All char-based filenames are assumed to be UTF-8 encoded.
Definition at line 403 of file filesystem.h.
Enumerator | |
---|---|
Closed | |
Read | |
Write |
Definition at line 405 of file filesystem.h.
|
inline |
Definition at line 406 of file filesystem.h.
|
inline |
Definition at line 407 of file filesystem.h.
|
inline |
Definition at line 409 of file filesystem.h.
|
inlinevirtual |
Definition at line 411 of file filesystem.h.
|
inlinevirtual |
Reimplemented in Filesystem::IOFile.
Definition at line 413 of file filesystem.h.
std::string Filesystem::IOProxy::error | ( | ) | const |
void Filesystem::IOProxy::error | ( | string_view | e | ) |
|
inline |
Definition at line 446 of file filesystem.h.
|
inlinevirtual |
Reimplemented in Filesystem::IOFile.
Definition at line 443 of file filesystem.h.
|
inline |
Definition at line 445 of file filesystem.h.
|
inlinevirtual |
Definition at line 414 of file filesystem.h.
|
virtual |
Read size
bytes starting at the offset
position into buf[]
, returning the number of bytes successfully read. This function does not alter the current file position. This function is thread-safe against all other concurrent calls to pread() and pwrite(), but not against any other function of IOProxy.
Reimplemented in Filesystem::IOMemReader, and Filesystem::IOFile.
|
pure virtual |
Implemented in Filesystem::IOMemReader, Filesystem::IOVecOutput, and Filesystem::IOFile.
|
virtual |
Write size
bytes from buf[]
to file starting at the offset
position, returning the number of bytes successfully written. This function does not alter the current file position. This function is thread-safe against all other concurrent calls to pread() and pwrite(), but not against any other function of IOProxy.
Reimplemented in Filesystem::IOVecOutput, and Filesystem::IOFile.
|
virtual |
Reimplemented in Filesystem::IOMemReader, and Filesystem::IOFile.
|
inline |
Definition at line 447 of file filesystem.h.
|
inlinevirtual |
Reimplemented in Filesystem::IOMemReader, and Filesystem::IOFile.
Definition at line 419 of file filesystem.h.
|
inline |
Definition at line 456 of file filesystem.h.
|
inlinevirtual |
Reimplemented in Filesystem::IOMemReader, Filesystem::IOVecOutput, and Filesystem::IOFile.
Definition at line 442 of file filesystem.h.
|
inlinevirtual |
Definition at line 415 of file filesystem.h.
|
virtual |
Reimplemented in Filesystem::IOVecOutput, and Filesystem::IOFile.
|
inline |
Definition at line 450 of file filesystem.h.
|
inline |
Definition at line 453 of file filesystem.h.
|
protected |
Definition at line 470 of file filesystem.h.
|
protected |
Definition at line 467 of file filesystem.h.
Definition at line 469 of file filesystem.h.
|
protected |
Definition at line 468 of file filesystem.h.