From: stephan b. <sg...@us...> - 2005-01-01 19:24:37
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6900/include/pclasses/IO Added Files: StringDevice.h Log Message: egg. IO experiment. --- NEW FILE: StringDevice.h --- #ifndef P_IO_STRINGDEVICE_HPP_INCLUDED #define P_IO_STRINGDEVICE_HPP_INCLUDED 1 #include "pclasses/IO/IODevice.h" #include "pclasses/Unicode/String.h" namespace P { namespace IO { /** StringDevice is an experiment to get to know the IO layer better. It implements an IODevice interface into a Unicode::String buffer of arbitrary size. */ class StringDevice : public IODevice { public: typedef ::P::Unicode::String StringType; StringDevice(){} virtual ~StringDevice() throw() {} virtual size_t read(char *buffer, size_t count) throw (IOError); virtual size_t peek(char *buffer, size_t count) throw (IOError); virtual size_t write(const char *buffer, size_t count) throw (IOError); virtual offset_t seek(offset_t offset, SeekMode mode) throw (IOError); virtual void close() throw (IOError) {} virtual offset_t getPos() throw (IOError) { return this->m_pos; } virtual bool isSeekable() const throw () { return true; } virtual void sync() const throw (IOError) {} virtual offset_t size () const throw (IOError) { return this->m_buf.size(); } StringType & str() { return this->m_buf; } const StringType & str() const { return this->m_buf; } private: size_t m_pos; StringType m_buf; }; } } // namespace P::IO #endif // P_IO_STRINGDEVICE_HPP_INCLUDED |