]> git.tdb.fi Git - libs/core.git/blob - source/io/mode.h
Use #ifdef _WIN32 rather than WIN32
[libs/core.git] / source / io / mode.h
1 #ifndef MSP_IO_MODE_H_
2 #define MSP_IO_MODE_H_
3
4 #include <stdexcept>
5
6 namespace Msp {
7 namespace IO {
8
9 enum Mode
10 {
11         M_NONE = 0,
12         M_READ = 1,
13         M_WRITE = 2,
14         M_RDWR = M_READ|M_WRITE,
15         M_APPEND = 4,
16         M_NONBLOCK = 8
17 };
18
19 inline Mode operator|(Mode m, Mode n)
20 { return Mode(static_cast<int>(m)|static_cast<int>(n)); }
21
22 inline Mode operator&(Mode m, Mode n)
23 { return Mode(static_cast<int>(m)&static_cast<int>(n)); }
24
25 inline Mode operator~(Mode m)
26 { return Mode(~static_cast<int>(m)); }
27
28
29 class invalid_access: public std::logic_error
30 {
31 public:
32         invalid_access(Mode);
33         ~invalid_access() throw() { }
34 };
35
36 } // namespace IO
37 } // namespace Msp
38
39 #endif