]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/mode.h
Add move semantics to Variant
[libs/core.git] / source / io / mode.h
index 5e103f278907be65a1f7f91da38ac34c5d113301..6230a6560936962c16ae448e888c9313b9e1890a 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef MSP_IO_MODE_H_
 #define MSP_IO_MODE_H_
 
+#include <stdexcept>
+#include <msp/core/mspcore_api.h>
+
 namespace Msp {
 namespace IO {
 
@@ -11,7 +14,8 @@ enum Mode
        M_WRITE = 2,
        M_RDWR = M_READ|M_WRITE,
        M_APPEND = 4,
-       M_NONBLOCK = 8
+       M_NONBLOCK = 8,
+       M_INHERIT = 16
 };
 
 inline Mode operator|(Mode m, Mode n)
@@ -23,6 +27,16 @@ inline Mode operator&(Mode m, Mode n)
 inline Mode operator~(Mode m)
 { return Mode(~static_cast<int>(m)); }
 
+inline void adjust_mode(Mode &m, Mode f, bool b)
+{ m = b ? (m|f) : (m&~f); }
+
+
+class MSPCORE_API invalid_access: public std::logic_error
+{
+public:
+       invalid_access(Mode);
+};
+
 } // namespace IO
 } // namespace Msp