windows-nt/Source/XPSP1/NT/com/oleutest/balls/common/stream.hxx
2020-09-26 16:20:57 +08:00

98 lines
2.6 KiB
C++
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//+-------------------------------------------------------------------
//
// File: stream.hxx
//
// Contents: Stream class on a file.
//
// Classes: CStreamOnFile
//
// History: 08-08-95 Rickhi Created
//
//--------------------------------------------------------------------
#ifndef __STREAMONFILE_HXX__
#define __STREAMONFILE_HXX__
//+-------------------------------------------------------------------
//
// Class: CStreamOnFile
//
// Purpose: Stream wrapper for a flat file.
//
// History: 30-Jan-93 Ricksa Created
//
//--------------------------------------------------------------------
class CStreamOnFile : public IStream
{
public:
CStreamOnFile(const TCHAR *pwszFileName, SCODE &sc, BOOL fRead);
~CStreamOnFile(void);
STDMETHOD(QueryInterface)(
REFIID iidInterface,
void FAR* FAR* ppvObj);
STDMETHOD_(ULONG,AddRef)(void);
STDMETHOD_(ULONG,Release)(void);
STDMETHOD(Read)(
VOID HUGEP* pv,
ULONG cb,
ULONG FAR* pcbRead);
STDMETHOD(Write)(
VOID const HUGEP* pv,
ULONG cb,
ULONG FAR* pcbWritten);
STDMETHOD(Seek)(
LARGE_INTEGER dlibMove,
DWORD dwOrigin,
ULARGE_INTEGER FAR* plibNewPosition);
STDMETHOD(SetSize) (ULARGE_INTEGER cb);
STDMETHOD(CopyTo)(
IStream FAR* pstm,
ULARGE_INTEGER cb,
ULARGE_INTEGER FAR* pcbRead,
ULARGE_INTEGER FAR* pcbWritten);
STDMETHOD(Commit)(DWORD grfCommitFlags);
STDMETHOD(Revert)(void);
STDMETHOD(LockRegion)(
ULARGE_INTEGER libOffset,
ULARGE_INTEGER cb,
DWORD dwLockType);
STDMETHOD(UnlockRegion)(
ULARGE_INTEGER libOffset,
ULARGE_INTEGER cb,
DWORD dwLockType);
STDMETHOD(Stat)(
STATSTG FAR* pstatstg,
DWORD statflag);
STDMETHOD(Clone)(IStream FAR * FAR *ppstm);
private:
LONG _clRefs; // reference count
HANDLE _hFile; // file handle
BOOL _fRead; // read or write side
ULONG _lOffset; // current seek ptr
ULONG _cSize; // number of bytes written
ULONG _cbData; // size of data
BYTE *_pbData; // ptr to data
};
#endif // _STREAMONFILE_HXX__