From 469bbcf0701e1eb8a6670c23145b0da87357e178 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 25 Mar 2012 20:00:08 +0000 Subject: Code is all reorganized. We're about ready to release. I should write up a little explenation of the arrangement. --- src/stable/nullstream.cpp | 127 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 src/stable/nullstream.cpp (limited to 'src/stable/nullstream.cpp') diff --git a/src/stable/nullstream.cpp b/src/stable/nullstream.cpp new file mode 100644 index 0000000..9552cc5 --- /dev/null +++ b/src/stable/nullstream.cpp @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2007-2011 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#include "bu/nullstream.h" + +Bu::NullStream::NullStream() : + sRead( 0 ), + sWrote( 0 ) +{ +} + +Bu::NullStream::~NullStream() +{ +} + +void Bu::NullStream::close() +{ + sRead = sWrote = 0; +} + +Bu::size Bu::NullStream::read( void *pBuf, Bu::size nBytes ) +{ + memset( pBuf, 0, nBytes ); + sRead += nBytes; + return nBytes; +} + +Bu::String Bu::NullStream::readLine() +{ + sRead++; + return Bu::String("\0", 1 ); +} + +Bu::size Bu::NullStream::write( const void *, Bu::size nBytes ) +{ + sWrote += nBytes; + return nBytes; +} + +Bu::size Bu::NullStream::tell() +{ + return sRead + sWrote; +} + +void Bu::NullStream::seek( Bu::size ) +{ +} + +void Bu::NullStream::setPos( Bu::size ) +{ +} + +void Bu::NullStream::setPosEnd( Bu::size ) +{ +} + +bool Bu::NullStream::isEos() +{ + return false; +} + +bool Bu::NullStream::isOpen() +{ + return true; +} + +void Bu::NullStream::flush() +{ +} + +bool Bu::NullStream::canRead() +{ + return true; +} + +bool Bu::NullStream::canWrite() +{ + return true; +} + +bool Bu::NullStream::isReadable() +{ + return true; +} + +bool Bu::NullStream::isWritable() +{ + return true; +} + +bool Bu::NullStream::isSeekable() +{ + return false; +} + +bool Bu::NullStream::isBlocking() +{ + return true; +} + +void Bu::NullStream::setBlocking( bool ) +{ +} + +void Bu::NullStream::setSize( Bu::size ) +{ +} + +Bu::size Bu::NullStream::getSize() const +{ + return 0; +} + +Bu::size Bu::NullStream::getBlockSize() const +{ + return 0; +} + +Bu::String Bu::NullStream::getLocation() const +{ + return ""; +} + -- cgit v1.2.3