X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fio%2Fhandle.h;h=561d710e457e77c73e7766f23d5bfd77f9b82310;hp=44b59371e56ef5262f1e0ba0dd621eb73ef0192a;hb=9990be018b49e5aae27218e1b8c6aefdb63b38a7;hpb=3b8384a993aed55b348bf51bb02900b3aa010ef8 diff --git a/source/io/handle.h b/source/io/handle.h index 44b5937..561d710 100644 --- a/source/io/handle.h +++ b/source/io/handle.h @@ -1,6 +1,8 @@ #ifndef MSP_IO_HANDLE_H_ #define MSP_IO_HANDLE_H_ +#include + namespace Msp { namespace IO { @@ -10,7 +12,7 @@ public: struct Private; private: - Private *priv; + Private *priv = 0; public: Handle(); @@ -21,12 +23,16 @@ 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; }; + +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 } // namespace Msp