other-licenses/7zstub/src/7zip/Common/FileStreams.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/other-licenses/7zstub/src/7zip/Common/FileStreams.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,98 @@
     1.4 +// FileStreams.h
     1.5 +
     1.6 +#ifndef __FILESTREAMS_H
     1.7 +#define __FILESTREAMS_H
     1.8 +
     1.9 +#ifdef _WIN32
    1.10 +#include "../../Windows/FileIO.h"
    1.11 +#else
    1.12 +#include "../../Common/C_FileIO.h"
    1.13 +#endif
    1.14 +
    1.15 +#include "../IStream.h"
    1.16 +#include "../../Common/MyCom.h"
    1.17 +
    1.18 +class CInFileStream: 
    1.19 +  public IInStream,
    1.20 +  public IStreamGetSize,
    1.21 +  public CMyUnknownImp
    1.22 +{
    1.23 +public:
    1.24 +  #ifdef _WIN32
    1.25 +  NWindows::NFile::NIO::CInFile File;
    1.26 +  #else
    1.27 +  NC::NFile::NIO::CInFile File;
    1.28 +  #endif
    1.29 +  CInFileStream() {}
    1.30 +  virtual ~CInFileStream() {}
    1.31 +
    1.32 +  bool Open(LPCTSTR fileName);
    1.33 +  #ifdef _WIN32
    1.34 +  #ifndef _UNICODE
    1.35 +  bool Open(LPCWSTR fileName);
    1.36 +  #endif
    1.37 +  #endif
    1.38 +
    1.39 +  MY_UNKNOWN_IMP2(IInStream, IStreamGetSize)
    1.40 +
    1.41 +  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
    1.42 +  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
    1.43 +
    1.44 +  STDMETHOD(GetSize)(UInt64 *size);
    1.45 +};
    1.46 +
    1.47 +#ifndef _WIN32_WCE
    1.48 +class CStdInFileStream: 
    1.49 +  public ISequentialInStream,
    1.50 +  public CMyUnknownImp
    1.51 +{
    1.52 +public:
    1.53 +  // HANDLE File;
    1.54 +  // CStdInFileStream() File(INVALID_HANDLE_VALUE): {}
    1.55 +  // void Open() { File = GetStdHandle(STD_INPUT_HANDLE); };
    1.56 +  MY_UNKNOWN_IMP
    1.57 +
    1.58 +  virtual ~CStdInFileStream() {}
    1.59 +  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
    1.60 +};
    1.61 +#endif
    1.62 +
    1.63 +class COutFileStream: 
    1.64 +  public IOutStream,
    1.65 +  public CMyUnknownImp
    1.66 +{
    1.67 +public:
    1.68 +  #ifdef _WIN32
    1.69 +  NWindows::NFile::NIO::COutFile File;
    1.70 +  #else
    1.71 +  NC::NFile::NIO::COutFile File;
    1.72 +  #endif
    1.73 +  virtual ~COutFileStream() {}
    1.74 +  bool Create(LPCTSTR fileName, bool createAlways);
    1.75 +  #ifdef _WIN32
    1.76 +  #ifndef _UNICODE
    1.77 +  bool Create(LPCWSTR fileName, bool createAlways);
    1.78 +  #endif
    1.79 +  #endif
    1.80 +  
    1.81 +  MY_UNKNOWN_IMP1(IOutStream)
    1.82 +
    1.83 +  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
    1.84 +  STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition);
    1.85 +  STDMETHOD(SetSize)(Int64 newSize);
    1.86 +};
    1.87 +
    1.88 +#ifndef _WIN32_WCE
    1.89 +class CStdOutFileStream: 
    1.90 +  public ISequentialOutStream,
    1.91 +  public CMyUnknownImp
    1.92 +{
    1.93 +public:
    1.94 +  MY_UNKNOWN_IMP
    1.95 +
    1.96 +  virtual ~CStdOutFileStream() {}
    1.97 +  STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
    1.98 +};
    1.99 +#endif
   1.100 +
   1.101 +#endif

mercurial