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 viostream_h 00009 #define viostream_h 00010 00013 #include "vtypes.h" 00014 00015 class VStream; 00016 00043 class VIOStream { 00044 public: 00045 00050 VIOStream(VStream& rawStream); 00054 virtual ~VIOStream() {} 00055 00062 void readGuaranteed(Vu8* targetBuffer, Vs64 numBytesToRead); 00067 Vu8 readGuaranteedByte(); 00074 Vs64 read(Vu8* targetBuffer, Vs64 numBytesToRead); 00075 00082 Vs64 write(const Vu8* buffer, Vs64 numBytesToWrite); 00088 void flush(); 00089 00097 bool skip(Vs64 numBytesToSkip); 00141 bool seek(Vs64 offset, int whence); 00148 bool seek0(); 00168 Vs64 getIOOffset() const; 00178 Vs64 available() const; 00179 00187 VStream& getRawStream(); 00188 00189 00195 static Vs16 streamCompare(VIOStream& streamA, VIOStream& streamB, Vs64 numBytesToCompare); 00196 00197 protected: 00198 00199 VStream& mRawStream; 00200 00201 private: 00202 00203 // Prevent copy construction and assignment since there is no provision for sharing a raw stream. 00204 VIOStream(const VIOStream& other); 00205 VIOStream& operator=(const VIOStream& other); 00206 }; 00207 00210 #endif /* viostream_h */