summaryrefslogtreecommitdiff
path: root/src/stable/streamstack.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-05 22:41:51 +0000
commitec05778d5718a7912e506764d443a78d6a6179e3 (patch)
tree78a9a01532180030c095acefc45763f07c14edb8 /src/stable/streamstack.cpp
parentb20414ac1fe80a71a90601f4cd1767fa7014a9ba (diff)
downloadlibbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.gz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.bz2
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.tar.xz
libbu++-ec05778d5718a7912e506764d443a78d6a6179e3.zip
Converted tabs to spaces with tabconv.
Diffstat (limited to 'src/stable/streamstack.cpp')
-rw-r--r--src/stable/streamstack.cpp134
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
14Bu::StreamStack::StreamStack( Bu::Stream *pStream ) 14Bu::StreamStack::StreamStack( Bu::Stream *pStream )
15{ 15{
16 lFilts.prepend( pStream ); 16 lFilts.prepend( pStream );
17} 17}
18 18
19Bu::StreamStack::~StreamStack() 19Bu::StreamStack::~StreamStack()
20{ 20{
21 clear(); 21 clear();
22} 22}
23 23
24bool Bu::StreamStack::isEmpty() 24bool Bu::StreamStack::isEmpty()
25{ 25{
26 return lFilts.isEmpty(); 26 return lFilts.isEmpty();
27} 27}
28 28
29bool Bu::StreamStack::hasStream() 29bool Bu::StreamStack::hasStream()
30{ 30{
31 return !lFilts.isEmpty(); 31 return !lFilts.isEmpty();
32} 32}
33 33
34void Bu::StreamStack::setStream( Bu::Stream *pStream ) 34void 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
42void Bu::StreamStack::clear() 42void 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
52void Bu::StreamStack::popFilter() 52void 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
61Bu::Stream *Bu::StreamStack::getTop() 61Bu::Stream *Bu::StreamStack::getTop()
62{ 62{
63 checkStack(); 63 checkStack();
64 64
65 return lFilts.first(); 65 return lFilts.first();
66} 66}
67 67
68Bu::Stream *Bu::StreamStack::getStream() 68Bu::Stream *Bu::StreamStack::getStream()
69{ 69{
70 checkStack(); 70 checkStack();
71 71
72 return lFilts.last(); 72 return lFilts.last();
73} 73}
74 74
75void Bu::StreamStack::close() 75void Bu::StreamStack::close()
76{ 76{
77 checkStack(); 77 checkStack();
78 78
79 lFilts.first()->close(); 79 lFilts.first()->close();
80} 80}
81 81
82Bu::size Bu::StreamStack::read( void *pBuf, Bu::size nBytes ) 82Bu::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
89Bu::size Bu::StreamStack::write( const void *pBuf, Bu::size nBytes ) 89Bu::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
96Bu::size Bu::StreamStack::write( const Bu::String &sBuf ) 96Bu::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
103Bu::size Bu::StreamStack::tell() 103Bu::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
110void Bu::StreamStack::seek( Bu::size offset ) 110void 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
117void Bu::StreamStack::setPos( Bu::size pos ) 117void 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
124void Bu::StreamStack::setPosEnd( Bu::size pos ) 124void 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
131bool Bu::StreamStack::isEos() 131bool 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
138bool Bu::StreamStack::isOpen() 138bool 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
145void Bu::StreamStack::flush() 145void Bu::StreamStack::flush()
146{ 146{
147 checkStack(); 147 checkStack();
148 148
149 lFilts.first()->flush(); 149 lFilts.first()->flush();
150} 150}
151 151
152bool Bu::StreamStack::canRead() 152bool 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
159bool Bu::StreamStack::canWrite() 159bool 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
166bool Bu::StreamStack::isReadable() 166bool 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
173bool Bu::StreamStack::isWritable() 173bool 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
180bool Bu::StreamStack::isSeekable() 180bool 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
187bool Bu::StreamStack::isBlocking() 187bool 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
194void Bu::StreamStack::setBlocking( bool bBlocking ) 194void 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
201void Bu::StreamStack::setSize( Bu::size iSize ) 201void 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
208Bu::size Bu::StreamStack::getSize() const 208Bu::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
215Bu::size Bu::StreamStack::getBlockSize() const 215Bu::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
222Bu::String Bu::StreamStack::getLocation() const 222Bu::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
229inline void Bu::StreamStack::checkStack() const 229inline 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