aboutsummaryrefslogtreecommitdiff
path: root/src/myriadstream.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/myriadstream.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 '')
-rw-r--r--src/myriadstream.cpp35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/myriadstream.cpp b/src/myriadstream.cpp
index 74dca04..a968a0c 100644
--- a/src/myriadstream.cpp
+++ b/src/myriadstream.cpp
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved. 2 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
3 * 3 *
4 * This file is part of the libbu++ library and is released under the 4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
@@ -46,13 +46,13 @@ void Bu::MyriadStream::close()
46{ 46{
47} 47}
48 48
49size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) 49Bu::size Bu::MyriadStream::read( void *pBuf, Bu::size nBytes )
50{ 50{
51#ifdef MYRIAD_STREAM_DEBUG 51#ifdef MYRIAD_STREAM_DEBUG
52 sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b." 52 sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b."
53 << sio.nl; 53 << sio.nl;
54#endif 54#endif
55 if( nBytes > (size_t)pStream->iSize-iPos ) 55 if( nBytes > (Bu::size)pStream->iSize-iPos )
56 nBytes = pStream->iSize-iPos; 56 nBytes = pStream->iSize-iPos;
57 if( nBytes <= 0 ) 57 if( nBytes <= 0 )
58 return 0; 58 return 0;
@@ -109,7 +109,7 @@ size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes )
109 return nBytes; 109 return nBytes;
110} 110}
111 111
112size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) 112Bu::size Bu::MyriadStream::write( const void *pBuf, Bu::size nBytes )
113{ 113{
114 if( nBytes <= 0 ) 114 if( nBytes <= 0 )
115 return 0; 115 return 0;
@@ -215,22 +215,22 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes )
215 return nBytes; 215 return nBytes;
216} 216}
217 217
218long Bu::MyriadStream::tell() 218Bu::size Bu::MyriadStream::tell()
219{ 219{
220 return iPos; 220 return iPos;
221} 221}
222 222
223void Bu::MyriadStream::seek( long offset ) 223void Bu::MyriadStream::seek( Bu::size offset )
224{ 224{
225 iPos += offset; 225 iPos += offset;
226} 226}
227 227
228void Bu::MyriadStream::setPos( long pos ) 228void Bu::MyriadStream::setPos( Bu::size pos )
229{ 229{
230 iPos = pos; 230 iPos = pos;
231} 231}
232 232
233void Bu::MyriadStream::setPosEnd( long pos ) 233void Bu::MyriadStream::setPosEnd( Bu::size pos )
234{ 234{
235 iPos = pStream->iSize-pos; 235 iPos = pStream->iSize-pos;
236} 236}
@@ -283,7 +283,7 @@ void Bu::MyriadStream::setBlocking( bool /*bBlocking*/ )
283{ 283{
284} 284}
285 285
286void Bu::MyriadStream::setSize( long iSize ) 286void Bu::MyriadStream::setSize( Bu::size iSize )
287{ 287{
288 if( iSize < 0 ) 288 if( iSize < 0 )
289 iSize = 0; 289 iSize = 0;
@@ -292,3 +292,20 @@ void Bu::MyriadStream::setSize( long iSize )
292 iPos = iSize; 292 iPos = iSize;
293} 293}
294 294
295Bu::size Bu::MyriadStream::getSize() const
296{
297 return pStream->iSize;
298}
299
300Bu::size Bu::MyriadStream::getBlockSize() const
301{
302 return rMyriad.getBlockSize();
303}
304
305Bu::String Bu::MyriadStream::getLocation() const
306{
307 Bu::String s;
308 s.format("%d", pStream->iId );
309 return s;
310}
311