Vault
4.1
|
00001 /* 00002 Copyright c1997-2014 Trygve Isaacson. All rights reserved. 00003 This file is part of the Code Vault version 4.1 00004 http://www.bombaydigital.com/ 00005 License: MIT. See LICENSE.md in the Vault top level directory. 00006 */ 00007 00008 #ifndef vsocketstream_h 00009 #define vsocketstream_h 00010 00013 #include "vstream.h" 00014 00015 class VSocket; 00016 00032 class VSocketStream : public VStream { 00033 public: 00034 00039 VSocketStream(const VString& name); 00045 VSocketStream(VSocket* socket, const VString& name); 00050 VSocketStream(const VSocketStream& other); 00054 virtual ~VSocketStream() {} 00055 00060 VSocketStream& operator=(const VSocketStream& other); 00061 00066 VSocket* getSocket() const; 00071 void setSocket(VSocket* socket); 00072 00073 // Required VStream method overrides: 00074 00081 virtual Vs64 read(Vu8* targetBuffer, Vs64 numBytesToRead); 00088 virtual Vs64 write(const Vu8* buffer, Vs64 numBytesToWrite); 00092 virtual void flush(); 00097 virtual bool skip(Vs64 numBytesToSkip); 00107 virtual bool seek(Vs64 offset, int whence); 00113 virtual Vs64 getIOOffset() const; 00123 virtual Vs64 available() const; 00124 00125 private: 00126 00127 VSocket* mSocket; 00128 }; 00129 00130 #endif /* vsocketstream_h */ 00131