From b5b68088f28b2593bfbf910a46fd52775007e8b3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 19 Nov 2007 09:39:24 +0000 Subject: Added the Bu::StdStream Stream class, it's just a wrapper for writing to, reading from standard output/input. --- src/stdstream.cpp | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 src/stdstream.cpp (limited to 'src/stdstream.cpp') diff --git a/src/stdstream.cpp b/src/stdstream.cpp new file mode 100644 index 0000000..1ddb3c1 --- /dev/null +++ b/src/stdstream.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2007 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/stdstream.h" + +Bu::StdStream::StdStream() +{ +} + +Bu::StdStream::~StdStream() +{ +} + +void Bu::StdStream::close() +{ +} + +size_t Bu::StdStream::read( void *pBuf, size_t nBytes ) +{ + return fread( pBuf, 1, nBytes, stdin ); +} + +size_t Bu::StdStream::write( const void *pBuf, size_t nBytes ) +{ + return fwrite( pBuf, 1, nBytes, stdout ); +} + +long Bu::StdStream::tell() +{ + return 0; +} + +void Bu::StdStream::seek( long offset ) +{ +} + +void Bu::StdStream::setPos( long pos ) +{ +} + +void Bu::StdStream::setPosEnd( long pos ) +{ +} + +bool Bu::StdStream::isEOS() +{ + return false; +} + +bool Bu::StdStream::isOpen() +{ + return true; +} + +void Bu::StdStream::flush() +{ + fflush( stdout ); +} + +bool Bu::StdStream::canRead() +{ + return true; +} + +bool Bu::StdStream::canWrite() +{ + return true; +} + +bool Bu::StdStream::isReadable() +{ + return true; +} + +bool Bu::StdStream::isWritable() +{ + return true; +} + +bool Bu::StdStream::isSeekable() +{ + return false; +} + +bool Bu::StdStream::isBlocking() +{ + return true; +} + +void Bu::StdStream::setBlocking( bool bBlocking ) +{ +} + -- cgit v1.2.3