From: Christian P. <cp...@us...> - 2005-05-25 09:35:08
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/IO In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24740/include/pclasses/IO Modified Files: IORequest.h Log Message: - Renamed IORequest::open() to IORequest::connect() and IORequest::close() to IORequest::disconnect() to support deriving from IODevice - Derived IORequest_Get and IORequest_Put from IODevice Index: IORequest.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/IO/IORequest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- IORequest.h 25 May 2005 08:02:56 -0000 1.1 +++ IORequest.h 25 May 2005 09:34:59 -0000 1.2 @@ -23,6 +23,7 @@ #include <pclasses/Export.h> #include <pclasses/NonCopyable.h> +#include <pclasses/IO/IODevice.h> #include <pclasses/IO/URL.h> namespace P { @@ -32,37 +33,43 @@ class PIO_EXPORT IORequest: public NonCopyable { public: IORequest(const URL& url); - virtual ~IORequest(); + virtual ~IORequest() throw(); const URL& url() const throw(); - virtual void open() = 0; - virtual void close() = 0; + virtual void connect() throw(IOError) = 0; + virtual void disconnect() throw(IOError) = 0; private: URL _url; }; -class PIO_EXPORT IORequest_Get: public IORequest { +class PIO_EXPORT IORequest_Get: public IORequest, public IODevice { public: IORequest_Get(const URL& url); - ~IORequest_Get(); + ~IORequest_Get() throw(); - virtual size_t read(char* buffer, size_t count) = 0; + private: + size_t _read(char* buffer, size_t count) throw(IOError) = 0; + size_t _write(const char* buffer, size_t count) throw(IOError); + void _close() throw(IOError); }; -class PIO_EXPORT IORequest_Put: public IORequest { +class PIO_EXPORT IORequest_Put: public IORequest, public IODevice { public: IORequest_Put(const URL& url); - ~IORequest_Put(); + ~IORequest_Put() throw(); - virtual size_t write(const char* buffer, size_t count) = 0; + private: + size_t _read(char* buffer, size_t count) throw(IOError); + size_t _write(const char* buffer, size_t count) throw(IOError) = 0; + void _close() throw(IOError); }; class PIO_EXPORT IORequest_Unlink: public IORequest { public: IORequest_Unlink(const URL& url); - ~IORequest_Unlink(); + ~IORequest_Unlink() throw(); virtual void doit() = 0; }; @@ -70,7 +77,7 @@ class PIO_EXPORT IORequest_MakeDir: public IORequest { public: IORequest_MakeDir(const URL& url); - ~IORequest_MakeDir(); + ~IORequest_MakeDir() throw(); virtual void doit() = 0; }; @@ -78,7 +85,7 @@ class PIO_EXPORT IORequest_RemoveDir: public IORequest { public: IORequest_RemoveDir(const URL& url); - ~IORequest_RemoveDir(); + ~IORequest_RemoveDir() throw(); virtual void doit() = 0; }; @@ -86,7 +93,7 @@ class PIO_EXPORT IORequest_ListDir: public IORequest { public: IORequest_ListDir(const URL& url); - ~IORequest_ListDir(); + ~IORequest_ListDir() throw(); virtual size_t read(char* buffer, size_t count) = 0; }; |