]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/handle.h
Add move semantics to Variant
[libs/core.git] / source / io / handle.h
index 44b59371e56ef5262f1e0ba0dd621eb73ef0192a..06c2034c5271995995fd2929027cc1951fcf9d7d 100644 (file)
@@ -1,16 +1,19 @@
 #ifndef MSP_IO_HANDLE_H_
 #define MSP_IO_HANDLE_H_
 
+#include <cstddef>
+#include <msp/core/mspcore_api.h>
+
 namespace Msp {
 namespace IO {
 
-class Handle
+class MSPCORE_API Handle
 {
 public:
        struct Private;
 
 private:
-       Private *priv;
+       Private *priv = nullptr;
 
 public:
        Handle();
@@ -21,12 +24,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