diff options
Diffstat (limited to '')
-rw-r--r-- | src/streamstack.cpp | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/src/streamstack.cpp b/src/streamstack.cpp index f400364..d45306d 100644 --- a/src/streamstack.cpp +++ b/src/streamstack.cpp | |||
@@ -1,3 +1,10 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
1 | #include "bu/streamstack.h" | 8 | #include "bu/streamstack.h" |
2 | 9 | ||
3 | Bu::StreamStack::StreamStack() | 10 | Bu::StreamStack::StreamStack() |
@@ -72,49 +79,49 @@ void Bu::StreamStack::close() | |||
72 | lFilts.first()->close(); | 79 | lFilts.first()->close(); |
73 | } | 80 | } |
74 | 81 | ||
75 | size_t Bu::StreamStack::read( void *pBuf, size_t nBytes ) | 82 | Bu::size Bu::StreamStack::read( void *pBuf, Bu::size nBytes ) |
76 | { | 83 | { |
77 | checkStack(); | 84 | checkStack(); |
78 | 85 | ||
79 | return lFilts.first()->read( pBuf, nBytes ); | 86 | return lFilts.first()->read( pBuf, nBytes ); |
80 | } | 87 | } |
81 | 88 | ||
82 | size_t Bu::StreamStack::write( const void *pBuf, size_t nBytes ) | 89 | Bu::size Bu::StreamStack::write( const void *pBuf, Bu::size nBytes ) |
83 | { | 90 | { |
84 | checkStack(); | 91 | checkStack(); |
85 | 92 | ||
86 | return lFilts.first()->write( pBuf, nBytes ); | 93 | return lFilts.first()->write( pBuf, nBytes ); |
87 | } | 94 | } |
88 | 95 | ||
89 | size_t Bu::StreamStack::write( const Bu::String &sBuf ) | 96 | Bu::size Bu::StreamStack::write( const Bu::String &sBuf ) |
90 | { | 97 | { |
91 | checkStack(); | 98 | checkStack(); |
92 | 99 | ||
93 | return lFilts.first()->write( sBuf ); | 100 | return lFilts.first()->write( sBuf ); |
94 | } | 101 | } |
95 | 102 | ||
96 | long Bu::StreamStack::tell() | 103 | Bu::size Bu::StreamStack::tell() |
97 | { | 104 | { |
98 | checkStack(); | 105 | checkStack(); |
99 | 106 | ||
100 | return lFilts.first()->tell(); | 107 | return lFilts.first()->tell(); |
101 | } | 108 | } |
102 | 109 | ||
103 | void Bu::StreamStack::seek( long offset ) | 110 | void Bu::StreamStack::seek( Bu::size offset ) |
104 | { | 111 | { |
105 | checkStack(); | 112 | checkStack(); |
106 | 113 | ||
107 | lFilts.first()->seek( offset ); | 114 | lFilts.first()->seek( offset ); |
108 | } | 115 | } |
109 | 116 | ||
110 | void Bu::StreamStack::setPos( long pos ) | 117 | void Bu::StreamStack::setPos( Bu::size pos ) |
111 | { | 118 | { |
112 | checkStack(); | 119 | checkStack(); |
113 | 120 | ||
114 | lFilts.first()->setPos( pos ); | 121 | lFilts.first()->setPos( pos ); |
115 | } | 122 | } |
116 | 123 | ||
117 | void Bu::StreamStack::setPosEnd( long pos ) | 124 | void Bu::StreamStack::setPosEnd( Bu::size pos ) |
118 | { | 125 | { |
119 | checkStack(); | 126 | checkStack(); |
120 | 127 | ||
@@ -191,14 +198,35 @@ void Bu::StreamStack::setBlocking( bool bBlocking ) | |||
191 | lFilts.first()->setBlocking( bBlocking ); | 198 | lFilts.first()->setBlocking( bBlocking ); |
192 | } | 199 | } |
193 | 200 | ||
194 | void Bu::StreamStack::setSize( long iSize ) | 201 | void Bu::StreamStack::setSize( Bu::size iSize ) |
195 | { | 202 | { |
196 | checkStack(); | 203 | checkStack(); |
197 | 204 | ||
198 | lFilts.first()->setSize( iSize ); | 205 | lFilts.first()->setSize( iSize ); |
199 | } | 206 | } |
200 | 207 | ||
201 | inline void Bu::StreamStack::checkStack() | 208 | Bu::size Bu::StreamStack::getSize() const |
209 | { | ||
210 | checkStack(); | ||
211 | |||
212 | return lFilts.first()->getSize(); | ||
213 | } | ||
214 | |||
215 | Bu::size Bu::StreamStack::getBlockSize() const | ||
216 | { | ||
217 | checkStack(); | ||
218 | |||
219 | return lFilts.first()->getBlockSize(); | ||
220 | } | ||
221 | |||
222 | Bu::String Bu::StreamStack::getLocation() const | ||
223 | { | ||
224 | checkStack(); | ||
225 | |||
226 | return lFilts.first()->getLocation(); | ||
227 | } | ||
228 | |||
229 | inline void Bu::StreamStack::checkStack() const | ||
202 | { | 230 | { |
203 | if( lFilts.isEmpty() ) | 231 | if( lFilts.isEmpty() ) |
204 | throw Bu::ExceptionBase("StreamStack is empty."); | 232 | throw Bu::ExceptionBase("StreamStack is empty."); |