X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fhandle.h;h=6140e116d74fb497d83085d921e11b515084616a;hp=24b9ee6a9e9e192b63fb4eb2230cd66050577c4c;hb=HEAD;hpb=6c40658510b68788fd5ef0488b20873b6aa32938 diff --git a/source/io/handle.h b/source/io/handle.h index 24b9ee6..06c2034 100644 --- a/source/io/handle.h +++ b/source/io/handle.h @@ -1,16 +1,19 @@ #ifndef MSP_IO_HANDLE_H_ #define MSP_IO_HANDLE_H_ +#include +#include + namespace Msp { namespace IO { -class Handle +class MSPCORE_API Handle { public: struct Private; private: - Private *priv; + Private *priv = nullptr; public: Handle(); @@ -21,15 +24,14 @@ public: Private &operator*() { return *priv; } const Private &operator*() const { return *priv; } - /** This is effectively a boolean conversion, but avoids accidental - conversion to OS native handles. Unix-based systems use int and win32 uses - void *; const void * is not implicitly convertible to either. */ - operator const void *() const; + explicit operator bool() const; }; -unsigned sys_read(Handle &, char *, unsigned); -unsigned sys_write(Handle &, const char *, unsigned); +void sys_set_blocking(Handle &, bool); +void sys_set_inherit(Handle &, bool); +std::size_t sys_read(Handle &, char *, std::size_t); +std::size_t sys_write(Handle &, const char *, std::size_t); void sys_close(Handle &); } // namespace IO