aboutsummaryrefslogtreecommitdiff
path: root/src/streamstack.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 05:30:43 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 05:30:43 +0000
commit7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2 (patch)
treee2d4bfccd81070adf7294ee54db2399df0c7171f /src/streamstack.cpp
parentf5aca1a1b402bd7ebc944dc6e6fe65828d863365 (diff)
downloadlibbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.gz
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.bz2
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.xz
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.zip
Wow, got the Stream changes propegated, all tests build with string instead of
fstring, and updated the copyright notice to extend to 2011
Diffstat (limited to 'src/streamstack.cpp')
-rw-r--r--src/streamstack.cpp46
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
3Bu::StreamStack::StreamStack() 10Bu::StreamStack::StreamStack()
@@ -72,49 +79,49 @@ void Bu::StreamStack::close()
72 lFilts.first()->close(); 79 lFilts.first()->close();
73} 80}
74 81
75size_t Bu::StreamStack::read( void *pBuf, size_t nBytes ) 82Bu::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
82size_t Bu::StreamStack::write( const void *pBuf, size_t nBytes ) 89Bu::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
89size_t Bu::StreamStack::write( const Bu::String &sBuf ) 96Bu::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
96long Bu::StreamStack::tell() 103Bu::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
103void Bu::StreamStack::seek( long offset ) 110void 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
110void Bu::StreamStack::setPos( long pos ) 117void 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
117void Bu::StreamStack::setPosEnd( long pos ) 124void 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
194void Bu::StreamStack::setSize( long iSize ) 201void 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
201inline void Bu::StreamStack::checkStack() 208Bu::size Bu::StreamStack::getSize() const
209{
210 checkStack();
211
212 return lFilts.first()->getSize();
213}
214
215Bu::size Bu::StreamStack::getBlockSize() const
216{
217 checkStack();
218
219 return lFilts.first()->getBlockSize();
220}
221
222Bu::String Bu::StreamStack::getLocation() const
223{
224 checkStack();
225
226 return lFilts.first()->getLocation();
227}
228
229inline 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.");