aboutsummaryrefslogtreecommitdiff
path: root/src/stream.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stream.h')
-rw-r--r--src/stream.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/stream.h b/src/stream.h
index ba070d3..056de0c 100644
--- a/src/stream.h
+++ b/src/stream.h
@@ -22,17 +22,66 @@ namespace Bu
22 Stream(); 22 Stream();
23 virtual ~Stream(); 23 virtual ~Stream();
24 24
25 /**
26 * Close the stream.
27 */
25 virtual void close() = 0; 28 virtual void close() = 0;
29
30 /**
31 * Read data from the stream into a buffer.
32 *@param pBuf (void *) Buffer which will be filled.
33 *@param nBytes (size_t) Max data to read.
34 *@returns (size_t) Amount of data read.
35 */
26 virtual size_t read( void *pBuf, size_t nBytes ) = 0; 36 virtual size_t read( void *pBuf, size_t nBytes ) = 0;
37
38 /**
39 * Write data to the stream.
40 *@param pBuf (const void *) The data to be written.
41 *@param nBytes (size_t) Amount of data to write from pBuf.
42 *@returns (size_t) Amount of data actually written.
43 */
27 virtual size_t write( const void *pBuf, size_t nBytes ) = 0; 44 virtual size_t write( const void *pBuf, size_t nBytes ) = 0;
28 45
46 /**
47 * Get the current position in the stream.
48 *@returns (long) The current position in the stream.
49 */
29 virtual long tell() = 0; 50 virtual long tell() = 0;
51
52 /**
53 * Seek to a position in the stream relative to the current position.
54 *@param offset (long) Offset from current position to seek to.
55 */
30 virtual void seek( long offset ) = 0; 56 virtual void seek( long offset ) = 0;
57
58 /**
59 * Set position in the stream relative to the start of the stream.
60 *@param pos (long) The position.
61 */
31 virtual void setPos( long pos ) = 0; 62 virtual void setPos( long pos ) = 0;
63
64 /**
65 * Set position in the stream relative to the end of the stream.
66 *@param pos (long) The position.
67 */
32 virtual void setPosEnd( long pos ) = 0; 68 virtual void setPosEnd( long pos ) = 0;
69
70 /**
71 * Are we at the end of the stream?
72 *@returns (bool) Are we at the end of the stream?
73 */
33 virtual bool isEOS() = 0; 74 virtual bool isEOS() = 0;
75
76 /**
77 * Is the stream open?
78 *@returns (bool) Is the stream open?
79 */
34 virtual bool isOpen() = 0; 80 virtual bool isOpen() = 0;
35 81
82 /**
83 * Flush any data still held in buffers.
84 */
36 virtual void flush() = 0; 85 virtual void flush() = 0;
37 86
38 /** 87 /**
@@ -71,7 +120,16 @@ namespace Bu
71 */ 120 */
72 virtual bool isSeekable() = 0; 121 virtual bool isSeekable() = 0;
73 122
123 /**
124 * Are we currently set to block mode?
125 *@returns (bool)
126 */
74 virtual bool isBlocking() = 0; 127 virtual bool isBlocking() = 0;
128
129 /**
130 * Set stream to blocking or non-blocking mode.
131 *@param bBlocking (bool) Whether we should block or not.
132 */
75 virtual void setBlocking( bool bBlocking=true ) = 0; 133 virtual void setBlocking( bool bBlocking=true ) = 0;
76 134
77 public: // Filters 135 public: // Filters