X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fio%2Fmode.h;h=a643a7f32074782bb863c99959d6d14e1a66f496;hb=99b9121e2158603372c7313400283b622e6754d8;hp=5e103f278907be65a1f7f91da38ac34c5d113301;hpb=c7afef88380ebebc8c2b04e48664d73281ec8848;p=libs%2Fcore.git diff --git a/source/io/mode.h b/source/io/mode.h index 5e103f2..a643a7f 100644 --- a/source/io/mode.h +++ b/source/io/mode.h @@ -1,6 +1,8 @@ #ifndef MSP_IO_MODE_H_ #define MSP_IO_MODE_H_ +#include + namespace Msp { namespace IO { @@ -11,7 +13,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 +26,17 @@ inline Mode operator&(Mode m, Mode n) inline Mode operator~(Mode m) { return Mode(~static_cast(m)); } +inline void adjust_mode(Mode &m, Mode f, bool b) +{ m = b ? (m|f) : (m&~f); } + + +class invalid_access: public std::logic_error +{ +public: + invalid_access(Mode); + virtual ~invalid_access() throw() = default; +}; + } // namespace IO } // namespace Msp