diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-11-05 22:41:51 +0000 |
commit | ec05778d5718a7912e506764d443a78d6a6179e3 (patch) | |
tree | 78a9a01532180030c095acefc45763f07c14edb8 /src/stable/streamstack.cpp | |
parent | b20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff) | |
download | libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2 libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip |
Converted tabs to spaces with tabconv.
Diffstat (limited to '')
-rw-r--r-- | src/stable/streamstack.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/src/stable/streamstack.cpp b/src/stable/streamstack.cpp index 47ae5c0..deafbcf 100644 --- a/src/stable/streamstack.cpp +++ b/src/stable/streamstack.cpp | |||
@@ -13,222 +13,222 @@ Bu::StreamStack::StreamStack() | |||
13 | 13 | ||
14 | Bu::StreamStack::StreamStack( Bu::Stream *pStream ) | 14 | Bu::StreamStack::StreamStack( Bu::Stream *pStream ) |
15 | { | 15 | { |
16 | lFilts.prepend( pStream ); | 16 | lFilts.prepend( pStream ); |
17 | } | 17 | } |
18 | 18 | ||
19 | Bu::StreamStack::~StreamStack() | 19 | Bu::StreamStack::~StreamStack() |
20 | { | 20 | { |
21 | clear(); | 21 | clear(); |
22 | } | 22 | } |
23 | 23 | ||
24 | bool Bu::StreamStack::isEmpty() | 24 | bool Bu::StreamStack::isEmpty() |
25 | { | 25 | { |
26 | return lFilts.isEmpty(); | 26 | return lFilts.isEmpty(); |
27 | } | 27 | } |
28 | 28 | ||
29 | bool Bu::StreamStack::hasStream() | 29 | bool Bu::StreamStack::hasStream() |
30 | { | 30 | { |
31 | return !lFilts.isEmpty(); | 31 | return !lFilts.isEmpty(); |
32 | } | 32 | } |
33 | 33 | ||
34 | void Bu::StreamStack::setStream( Bu::Stream *pStream ) | 34 | void Bu::StreamStack::setStream( Bu::Stream *pStream ) |
35 | { | 35 | { |
36 | if( !lFilts.isEmpty() ) | 36 | if( !lFilts.isEmpty() ) |
37 | throw Bu::ExceptionBase("There is already a stream set."); | 37 | throw Bu::ExceptionBase("There is already a stream set."); |
38 | 38 | ||
39 | lFilts.prepend( pStream ); | 39 | lFilts.prepend( pStream ); |
40 | } | 40 | } |
41 | 41 | ||
42 | void Bu::StreamStack::clear() | 42 | void Bu::StreamStack::clear() |
43 | { | 43 | { |
44 | for( FilterList::iterator i = lFilts.begin(); i; i++ ) | 44 | for( FilterList::iterator i = lFilts.begin(); i; i++ ) |
45 | { | 45 | { |
46 | delete *i; | 46 | delete *i; |
47 | } | 47 | } |
48 | 48 | ||
49 | lFilts.clear(); | 49 | lFilts.clear(); |
50 | } | 50 | } |
51 | 51 | ||
52 | void Bu::StreamStack::popFilter() | 52 | void Bu::StreamStack::popFilter() |
53 | { | 53 | { |
54 | if( lFilts.isEmpty() ) | 54 | if( lFilts.isEmpty() ) |
55 | return; | 55 | return; |
56 | 56 | ||
57 | delete lFilts.first(); | 57 | delete lFilts.first(); |
58 | lFilts.erase( lFilts.begin() ); | 58 | lFilts.erase( lFilts.begin() ); |
59 | } | 59 | } |
60 | 60 | ||
61 | Bu::Stream *Bu::StreamStack::getTop() | 61 | Bu::Stream *Bu::StreamStack::getTop() |
62 | { | 62 | { |
63 | checkStack(); | 63 | checkStack(); |
64 | 64 | ||
65 | return lFilts.first(); | 65 | return lFilts.first(); |
66 | } | 66 | } |
67 | 67 | ||
68 | Bu::Stream *Bu::StreamStack::getStream() | 68 | Bu::Stream *Bu::StreamStack::getStream() |
69 | { | 69 | { |
70 | checkStack(); | 70 | checkStack(); |
71 | 71 | ||
72 | return lFilts.last(); | 72 | return lFilts.last(); |
73 | } | 73 | } |
74 | 74 | ||
75 | void Bu::StreamStack::close() | 75 | void Bu::StreamStack::close() |
76 | { | 76 | { |
77 | checkStack(); | 77 | checkStack(); |
78 | 78 | ||
79 | lFilts.first()->close(); | 79 | lFilts.first()->close(); |
80 | } | 80 | } |
81 | 81 | ||
82 | Bu::size Bu::StreamStack::read( void *pBuf, Bu::size nBytes ) | 82 | Bu::size Bu::StreamStack::read( void *pBuf, Bu::size nBytes ) |
83 | { | 83 | { |
84 | checkStack(); | 84 | checkStack(); |
85 | 85 | ||
86 | return lFilts.first()->read( pBuf, nBytes ); | 86 | return lFilts.first()->read( pBuf, nBytes ); |
87 | } | 87 | } |
88 | 88 | ||
89 | Bu::size Bu::StreamStack::write( const void *pBuf, Bu::size nBytes ) | 89 | Bu::size Bu::StreamStack::write( const void *pBuf, Bu::size nBytes ) |
90 | { | 90 | { |
91 | checkStack(); | 91 | checkStack(); |
92 | 92 | ||
93 | return lFilts.first()->write( pBuf, nBytes ); | 93 | return lFilts.first()->write( pBuf, nBytes ); |
94 | } | 94 | } |
95 | 95 | ||
96 | Bu::size Bu::StreamStack::write( const Bu::String &sBuf ) | 96 | Bu::size Bu::StreamStack::write( const Bu::String &sBuf ) |
97 | { | 97 | { |
98 | checkStack(); | 98 | checkStack(); |
99 | 99 | ||
100 | return lFilts.first()->write( sBuf ); | 100 | return lFilts.first()->write( sBuf ); |
101 | } | 101 | } |
102 | 102 | ||
103 | Bu::size Bu::StreamStack::tell() | 103 | Bu::size Bu::StreamStack::tell() |
104 | { | 104 | { |
105 | checkStack(); | 105 | checkStack(); |
106 | 106 | ||
107 | return lFilts.first()->tell(); | 107 | return lFilts.first()->tell(); |
108 | } | 108 | } |
109 | 109 | ||
110 | void Bu::StreamStack::seek( Bu::size offset ) | 110 | void Bu::StreamStack::seek( Bu::size offset ) |
111 | { | 111 | { |
112 | checkStack(); | 112 | checkStack(); |
113 | 113 | ||
114 | lFilts.first()->seek( offset ); | 114 | lFilts.first()->seek( offset ); |
115 | } | 115 | } |
116 | 116 | ||
117 | void Bu::StreamStack::setPos( Bu::size pos ) | 117 | void Bu::StreamStack::setPos( Bu::size pos ) |
118 | { | 118 | { |
119 | checkStack(); | 119 | checkStack(); |
120 | 120 | ||
121 | lFilts.first()->setPos( pos ); | 121 | lFilts.first()->setPos( pos ); |
122 | } | 122 | } |
123 | 123 | ||
124 | void Bu::StreamStack::setPosEnd( Bu::size pos ) | 124 | void Bu::StreamStack::setPosEnd( Bu::size pos ) |
125 | { | 125 | { |
126 | checkStack(); | 126 | checkStack(); |
127 | 127 | ||
128 | lFilts.first()->setPosEnd( pos ); | 128 | lFilts.first()->setPosEnd( pos ); |
129 | } | 129 | } |
130 | 130 | ||
131 | bool Bu::StreamStack::isEos() | 131 | bool Bu::StreamStack::isEos() |
132 | { | 132 | { |
133 | checkStack(); | 133 | checkStack(); |
134 | 134 | ||
135 | return lFilts.first()->isEos(); | 135 | return lFilts.first()->isEos(); |
136 | } | 136 | } |
137 | 137 | ||
138 | bool Bu::StreamStack::isOpen() | 138 | bool Bu::StreamStack::isOpen() |
139 | { | 139 | { |
140 | checkStack(); | 140 | checkStack(); |
141 | 141 | ||
142 | return lFilts.first()->isOpen(); | 142 | return lFilts.first()->isOpen(); |
143 | } | 143 | } |
144 | 144 | ||
145 | void Bu::StreamStack::flush() | 145 | void Bu::StreamStack::flush() |
146 | { | 146 | { |
147 | checkStack(); | 147 | checkStack(); |
148 | 148 | ||
149 | lFilts.first()->flush(); | 149 | lFilts.first()->flush(); |
150 | } | 150 | } |
151 | 151 | ||
152 | bool Bu::StreamStack::canRead() | 152 | bool Bu::StreamStack::canRead() |
153 | { | 153 | { |
154 | checkStack(); | 154 | checkStack(); |
155 | 155 | ||
156 | return lFilts.first()->canRead(); | 156 | return lFilts.first()->canRead(); |
157 | } | 157 | } |
158 | 158 | ||
159 | bool Bu::StreamStack::canWrite() | 159 | bool Bu::StreamStack::canWrite() |
160 | { | 160 | { |
161 | checkStack(); | 161 | checkStack(); |
162 | 162 | ||
163 | return lFilts.first()->canWrite(); | 163 | return lFilts.first()->canWrite(); |
164 | } | 164 | } |
165 | 165 | ||
166 | bool Bu::StreamStack::isReadable() | 166 | bool Bu::StreamStack::isReadable() |
167 | { | 167 | { |
168 | checkStack(); | 168 | checkStack(); |
169 | 169 | ||
170 | return lFilts.first()->isReadable(); | 170 | return lFilts.first()->isReadable(); |
171 | } | 171 | } |
172 | 172 | ||
173 | bool Bu::StreamStack::isWritable() | 173 | bool Bu::StreamStack::isWritable() |
174 | { | 174 | { |
175 | checkStack(); | 175 | checkStack(); |
176 | 176 | ||
177 | return lFilts.first()->isWritable(); | 177 | return lFilts.first()->isWritable(); |
178 | } | 178 | } |
179 | 179 | ||
180 | bool Bu::StreamStack::isSeekable() | 180 | bool Bu::StreamStack::isSeekable() |
181 | { | 181 | { |
182 | checkStack(); | 182 | checkStack(); |
183 | 183 | ||
184 | return lFilts.first()->isSeekable(); | 184 | return lFilts.first()->isSeekable(); |
185 | } | 185 | } |
186 | 186 | ||
187 | bool Bu::StreamStack::isBlocking() | 187 | bool Bu::StreamStack::isBlocking() |
188 | { | 188 | { |
189 | checkStack(); | 189 | checkStack(); |
190 | 190 | ||
191 | return lFilts.first()->isBlocking(); | 191 | return lFilts.first()->isBlocking(); |
192 | } | 192 | } |
193 | 193 | ||
194 | void Bu::StreamStack::setBlocking( bool bBlocking ) | 194 | void Bu::StreamStack::setBlocking( bool bBlocking ) |
195 | { | 195 | { |
196 | checkStack(); | 196 | checkStack(); |
197 | 197 | ||
198 | lFilts.first()->setBlocking( bBlocking ); | 198 | lFilts.first()->setBlocking( bBlocking ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void Bu::StreamStack::setSize( Bu::size iSize ) | 201 | void Bu::StreamStack::setSize( Bu::size iSize ) |
202 | { | 202 | { |
203 | checkStack(); | 203 | checkStack(); |
204 | 204 | ||
205 | lFilts.first()->setSize( iSize ); | 205 | lFilts.first()->setSize( iSize ); |
206 | } | 206 | } |
207 | 207 | ||
208 | Bu::size Bu::StreamStack::getSize() const | 208 | Bu::size Bu::StreamStack::getSize() const |
209 | { | 209 | { |
210 | checkStack(); | 210 | checkStack(); |
211 | 211 | ||
212 | return lFilts.first()->getSize(); | 212 | return lFilts.first()->getSize(); |
213 | } | 213 | } |
214 | 214 | ||
215 | Bu::size Bu::StreamStack::getBlockSize() const | 215 | Bu::size Bu::StreamStack::getBlockSize() const |
216 | { | 216 | { |
217 | checkStack(); | 217 | checkStack(); |
218 | 218 | ||
219 | return lFilts.first()->getBlockSize(); | 219 | return lFilts.first()->getBlockSize(); |
220 | } | 220 | } |
221 | 221 | ||
222 | Bu::String Bu::StreamStack::getLocation() const | 222 | Bu::String Bu::StreamStack::getLocation() const |
223 | { | 223 | { |
224 | checkStack(); | 224 | checkStack(); |
225 | 225 | ||
226 | return lFilts.first()->getLocation(); | 226 | return lFilts.first()->getLocation(); |
227 | } | 227 | } |
228 | 228 | ||
229 | inline void Bu::StreamStack::checkStack() const | 229 | inline void Bu::StreamStack::checkStack() const |
230 | { | 230 | { |
231 | if( lFilts.isEmpty() ) | 231 | if( lFilts.isEmpty() ) |
232 | throw Bu::ExceptionBase("StreamStack is empty."); | 232 | throw Bu::ExceptionBase("StreamStack is empty."); |
233 | } | 233 | } |
234 | 234 | ||