winapi_common
|
HANDLE wrapper. More...
Public Member Functions | |
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 Member Functions | |
static bool | is_valid (HANDLE) |
static Handle | std_in () |
static Handle | std_out () |
static Handle | std_err () |
Static Public Attributes | |
static constexpr std::size_t | max_chunk_size = 16 * 1024 |
HANDLE wrapper.
This class wraps HANDLE, allowing for painless reads and writes from a random handle.
Definition at line 25 of file handle.hpp.
void winapi::Handle::close | ( | ) |
Close this handle.
Definition at line 47 of file handle.cpp.
bool winapi::Handle::is_std | ( | ) | const |
Check if this is a standard console handle.
Definition at line 51 of file handle.cpp.
|
static |
Check if this is the stdin handle.
Definition at line 55 of file handle.cpp.
|
static |
Check if this is the stdout handle.
Definition at line 59 of file handle.cpp.
|
static |
Check if this is the stderr handle.
Definition at line 63 of file handle.cpp.
Buffer winapi::Handle::read | ( | ) | const |
Read everything from this handle.
Definition at line 93 of file handle.cpp.
bool winapi::Handle::read_chunk | ( | Buffer & | read_chunk | ) | const |
Read a chunk from this handle.
read_chunk | Receives the data read. |
true
if there's more data, false
otherwise. Definition at line 67 of file handle.cpp.
void winapi::Handle::write | ( | const void * | data, |
std::size_t | nb | ||
) | const |
Write data to this handle.
data | Pointer to binary data. |
nb | Data size. |
Definition at line 109 of file handle.cpp.
void winapi::Handle::write | ( | const Buffer & | buffer | ) | const |
Write data to this handle.
buffer | Binary data to write. |
Definition at line 125 of file handle.cpp.
|
inline |
Write data to this handle.
src | Binary data to write. |
Definition at line 78 of file handle.hpp.