source: box/trunk/lib/common/MemBlockStream.h @ 217

Revision 217, 1.5 KB checked in by martin, 6 years ago (diff)

Set svn:eol-style as appropriate for all files

  • Property svn:eol-style set to native
Line 
1// --------------------------------------------------------------------------
2//
3// File
4//              Name:    MemBlockStream.h
5//              Purpose: Stream out data from any memory block
6//              Created: 2003/09/05
7//
8// --------------------------------------------------------------------------
9
10#ifndef MEMBLOCKSTREAM__H
11#define MEMBLOCKSTREAM__H
12
13#include "IOStream.h"
14
15class StreamableMemBlock;
16class CollectInBufferStream;
17
18// --------------------------------------------------------------------------
19//
20// Class
21//              Name:    MemBlockStream
22//              Purpose: Stream out data from any memory block -- be careful the lifetime
23//                               of the block is greater than the lifetime of this stream.
24//              Created: 2003/09/05
25//
26// --------------------------------------------------------------------------
27class MemBlockStream : public IOStream
28{
29public:
30        MemBlockStream(const void *pBuffer, int Size);
31        MemBlockStream(const StreamableMemBlock &rBlock);
32        MemBlockStream(const CollectInBufferStream &rBuffer);
33        MemBlockStream(const MemBlockStream &rToCopy);
34        ~MemBlockStream();
35public:
36
37        virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
38        virtual pos_type BytesLeftToRead();
39        virtual void Write(const void *pBuffer, int NBytes);
40        virtual pos_type GetPosition() const;
41        virtual void Seek(pos_type Offset, int SeekType);
42        virtual bool StreamDataLeft();
43        virtual bool StreamClosed();
44
45private:
46        const char *mpBuffer;
47        int mBytesInBuffer;
48        int mReadPosition;
49};
50
51#endif // MEMBLOCKSTREAM__H
52
Note: See TracBrowser for help on using the repository browser.