Changeset 31:bbd688924703 in xplcommon for src/xplcommon/BlockingStream.h
- Timestamp:
- 01/02/13 13:58:25 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/BlockingStream.h
r30 r31 35 35 36 36 #include "BufferedStream.h" 37 37 38 #include "Waiter.h" 38 39 #include "WaitableEvent.h" … … 76 77 size_t readingOffset; 77 78 79 /** 80 * Indicate if the end-of-file has been reached while reading. 81 */ 82 bool eof; 83 78 84 public: 79 85 /** … … 83 89 */ 84 90 BlockingStream(BufferedStream& stream); 91 92 /** 93 * Determine if the stream has neither failed nor been 94 * interrupted. 95 */ 96 operator bool() const; 85 97 86 98 /** … … 102 114 */ 103 115 bool read(void* dest, size_t length); 116 117 /** 118 * Skip the given number of bytes. 119 */ 120 bool skip(size_t length); 104 121 105 122 /** … … 125 142 */ 126 143 bool fill(); 144 145 /** 146 * Check for the stream being interrupted. 147 * 148 * @return if the stream is interrupted, false otherwise 149 */ 150 bool checkInterrupted(); 127 151 }; 128 152 … … 135 159 event(stream.getWaiter()), 136 160 interrupted(false), 137 readingOffset(0) 161 readingOffset(0), 162 eof(false) 138 163 { 164 } 165 166 //------------------------------------------------------------------------------ 167 168 inline BlockingStream::operator bool() const 169 { 170 return !failed() && !interrupted && !eof; 139 171 } 140 172 … … 144 176 { 145 177 event.fire(); 178 } 179 180 //------------------------------------------------------------------------------ 181 182 inline bool BlockingStream::isInterrupted() 183 { 184 return interrupted; 146 185 } 147 186
Note:
See TracChangeset
for help on using the changeset viewer.