File I/O.
More...
|
| File (Handle &&handle) |
|
std::size_t | get_size () const |
|
ID | query_id () const |
|
Public Member Functions inherited from winapi::Handle |
| Handle (HANDLE) |
|
HANDLE | get () const |
|
HANDLE | ptr () const |
|
| operator HANDLE () const |
|
bool | is_valid () const |
|
void | close () |
|
bool | is_std () const |
|
Buffer | read () const |
|
bool | read_chunk (Buffer &read_chunk) const |
|
void | write (const void *data, std::size_t nb) const |
|
void | write (const Buffer &buffer) const |
|
template<typename CharT > |
void | write (const std::basic_string< CharT > &src) const |
|
void | inherit (bool yes=true) const |
|
void | dont_inherit () const |
|
|
Static Public Attributes inherited from winapi::Handle |
static constexpr std::size_t | max_chunk_size = 16 * 1024 |
|
File I/O.
Easily open, read & write files.
Definition at line 29 of file file.hpp.
◆ File()
winapi::File::File |
( |
Handle && |
handle | ) |
|
|
inlineexplicit |
Make a File instance from an open handle.
Definition at line 59 of file file.hpp.
◆ open_r() [1/2]
File winapi::File::open_r |
( |
const std::string & |
path | ) |
|
|
static |
Open file for reading.
Definition at line 92 of file file.cpp.
◆ open_r() [2/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 96 of file file.cpp.
◆ open_read_attributes() [1/2]
File winapi::File::open_read_attributes |
( |
const std::string & |
path | ) |
|
|
static |
Open file for reading (inc. ability to read its attributes).
Definition at line 100 of file file.cpp.
◆ open_read_attributes() [2/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 104 of file file.cpp.
◆ open_w() [1/2]
File winapi::File::open_w |
( |
const std::string & |
path | ) |
|
|
static |
Open file for writing.
Definition at line 108 of file file.cpp.
◆ open_w() [2/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 112 of file file.cpp.
◆ remove() [1/2]
void winapi::File::remove |
( |
const std::string & |
path | ) |
|
|
static |
Delete a file.
Definition at line 116 of file file.cpp.
◆ remove() [2/2]
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 120 of file file.cpp.
◆ get_size()
std::size_t winapi::File::get_size |
( |
| ) |
const |
Get file size.
- Returns
- File size, bytes.
Definition at line 124 of file file.cpp.
◆ query_id()
File::ID winapi::File::query_id |
( |
| ) |
const |
Get file ID. File ID is a unique representation of a file, suitable for hashing.
Definition at line 139 of file file.cpp.
The documentation for this class was generated from the following files: