• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/io/NullStream.h

00001 /*
00002  *   This file is part of the Standard Portable Library (SPL).
00003  *
00004  *   SPL is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   SPL is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with SPL.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 #ifndef _nullstream_h
00018 #define _nullstream_h
00019 
00020 #include <spl/io/Stream.h>
00021 
00028 class NullStream;
00029 typedef RefCountPtrCast<NullStream, spl::IStream, spl::IStreamPtr> NullStreamPtr;
00030 typedef WeakReference<NullStream, spl::IStreamPtr> NullStreamRef;
00031 
00032 REGISTER_TYPEOF(114, NullStreamPtr);
00033 REGISTER_TYPEOF( 461, NullStreamRef );
00034 
00037 class NullStream : public spl::IStream
00038 {
00039 public: 
00040         NullStream();
00041         virtual ~NullStream();
00042 
00043         virtual void Close();
00044         virtual void Flush();
00045         virtual int Read(Array<byte>& buffer, const int offset, int count);
00046         virtual int ReadByte();
00047         virtual long Seek(const long offset, const SeekOrigin origin);
00048         virtual void Write(const Array<byte>& buffer, const int offset, const int count);
00049         virtual void WriteByte(byte value);
00050 
00051         virtual bool CanRead() const;
00052         virtual bool CanSeek() const;
00053         virtual bool CanWrite() const;
00054 
00055         virtual long Length() const;
00056         virtual long Position() const;
00057 #ifdef DEBUG
00058         virtual void ValidateMem() const;
00059         virtual void CheckMem() const;
00060 #endif
00061 };
00062 
00063 REGISTER_TYPEOF(116, NullStream);
00064 
00067 #endif