📄 streams.hpp
字号:
//// This file is part of the "More for C++" library//// Copyright (c) 1999-2003 by Thorsten Goertz (thorsten@morefor.org)//// The "More for C++" library is free software; you can redistribute it and/or// modify it under the terms of the license that comes with this package.//// Read "license.txt" for more details.//// THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED// WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES// OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.////////////////////////////////////////////////////////////////////////////////#ifndef MORE_IO_STREAMS_HPP#define MORE_IO_STREAMS_HPP////////////////////////////////////////////////////////////////////////////////#include <cstddef>#include <more/array.hpp>#include <more/string.hpp>#include <more/io/ioexception.hpp>////////////////////////////////////////////////////////////////////////////////namespace more{ namespace io { class InputStream { public: virtual size_t available( ) throw( IOException ) = 0; virtual bool hasBeenClosed( ) throw( IOException ) = 0; virtual size_t skip( size_t nNoOfBytes ) throw( IOException ) = 0; virtual size_t read( void* pBuffer, size_t nMaxNoOfBytes ) throw( IOException ) = 0; virtual InputStream& operator >> ( bool& rbBoolean ) throw( IOException ); virtual InputStream& operator >> ( char& rnChar ) throw( IOException ); virtual InputStream& operator >> ( unsigned char& rnUnsignedChar ) throw( IOException ); virtual InputStream& operator >> ( short& rnShort ) throw( IOException ); virtual InputStream& operator >> ( unsigned short& rnUnsignedShort ) throw( IOException ); virtual InputStream& operator >> ( int& rnInt ) throw( IOException ); virtual InputStream& operator >> ( unsigned int& rnUnsignedInt ) throw( IOException ); virtual InputStream& operator >> ( long& rnLong ) throw( IOException ); virtual InputStream& operator >> ( unsigned long& rnUnsignedLong ) throw( IOException ); virtual InputStream& operator >> ( float& rnFloat ) throw( IOException ); virtual InputStream& operator >> ( double& rnDouble ) throw( IOException ); virtual InputStream& operator >> ( String& rsString ) throw( IOException ); virtual InputStream& operator >> ( Array<bool>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<char>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<unsigned char>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<short>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<unsigned short>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<int>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<unsigned int>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<long>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<unsigned long>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<float>& rArray ) throw( IOException ); virtual InputStream& operator >> ( Array<double>& rArray ) throw( IOException ); protected: virtual ~InputStream( ); }; //////////////////////////////////////////////////////////////////////// class OutputStream { public: virtual void write( const void* pBuffer, size_t nNoOfBytes ) throw( IOException ) = 0; virtual size_t rewind( size_t nNoOfBytes ) throw( IOException ) = 0; virtual bool hasBeenClosed( ) throw( IOException ) = 0; virtual void flush( ) throw( IOException ) = 0; virtual OutputStream& operator << ( const bool& rbBoolean ) throw( IOException ); virtual OutputStream& operator << ( const char& rnChar ) throw( IOException ); virtual OutputStream& operator << ( const unsigned char& rnUnsignedChar ) throw( IOException ); virtual OutputStream& operator << ( const short& rnShort ) throw( IOException ); virtual OutputStream& operator << ( const unsigned short& rnUnsignedShort ) throw( IOException ); virtual OutputStream& operator << ( const int& rnInt ) throw( IOException ); virtual OutputStream& operator << ( const unsigned int& rnUnsignedInt ) throw( IOException ); virtual OutputStream& operator << ( const long& rnInt ) throw( IOException ); virtual OutputStream& operator << ( const unsigned long& rnUnsignedInt ) throw( IOException ); virtual OutputStream& operator << ( const float& rnFloat ) throw( IOException ); virtual OutputStream& operator << ( const double& rnDouble ) throw( IOException ); virtual OutputStream& operator << ( const char* pcString ) throw( IOException ); virtual OutputStream& operator << ( const String& rsString ) throw( IOException ); virtual OutputStream& operator << ( const Array<bool>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<char>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<unsigned char>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<short>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<unsigned short>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<int>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<unsigned int>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<long>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<unsigned long>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<float>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<double>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<const char*>& rArray ) throw( IOException ); virtual OutputStream& operator << ( const Array<String>& rArray ) throw( IOException ); protected: virtual ~OutputStream( ); }; }}////////////////////////////////////////////////////////////////////////////////#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -