1 /**
2  * Copyright: Copyright Jason White, 2014-2016
3  * License:   $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
4  * Authors:   Jason White
5  */
6 module io.stream.types;
7 
8 /**
9  * Specifies how to access a stream.
10  */
11 enum Access
12 {
13     /// Default access. Not very useful.
14     none = 0,
15 
16     /// Allows only read operations on the stream.
17     read = 1 << 0,
18 
19     /// Allows only write operations on the stream.
20     write = 1 << 1,
21 
22     /// Allows data to be executed. This is only used for memory mapped files.
23     execute = 1 << 2,
24 
25     /// Allows both read and write operations on the stream.
26     readWrite = read | write,
27 
28     /// Complete access.
29     all = read | write | execute,
30 }
31 
32 /**
33  * Relative position to seek from.
34  */
35 enum From
36 {
37     /// Seek relative to the beginning of the stream.
38     start,
39 
40     /// Seek relative to the current position in the stream.
41     here,
42 
43     /// Seek relative to the end of the stream.
44     end,
45 }
46 
47 /**
48  * Stream exceptions.
49  */
50 class StreamException : Exception       { this(string msg) { super(msg); } }
51 
52 /// Ditto
53 class ReadException   : StreamException { this(string msg) { super(msg); } }
54 
55 /// Ditto
56 class WriteException  : StreamException { this(string msg) { super(msg); } }
57 
58 /// Ditto
59 class SeekException   : StreamException { this(string msg) { super(msg); } }