summaryrefslogtreecommitdiff
path: root/lib/server/ProtocolUncertainStream.h
blob: 66397a39523f6d140b55df4c07b4b583bcf0ef62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// --------------------------------------------------------------------------
//
// File
//		Name:    PartialReadStream.h
//		Purpose: Read part of another stream
//		Created: 2003/12/05
//
// --------------------------------------------------------------------------

#ifndef PROTOCOLUNCERTAINSTREAM__H
#define PROTOCOLUNCERTAINSTREAM__H

#include "IOStream.h"

// --------------------------------------------------------------------------
//
// Class
//		Name:    PartialReadStream
//		Purpose: Read part of another stream
//		Created: 2003/12/05
//
// --------------------------------------------------------------------------
class ProtocolUncertainStream : public IOStream
{
public:
	ProtocolUncertainStream(IOStream &rSource);
	~ProtocolUncertainStream();
private:
	// no copying allowed
	ProtocolUncertainStream(const IOStream &);
	ProtocolUncertainStream(const ProtocolUncertainStream &);
	
public:
	virtual int Read(void *pBuffer, int NBytes, int Timeout = IOStream::TimeOutInfinite);
	virtual pos_type BytesLeftToRead();
	virtual void Write(const void *pBuffer, int NBytes);
	virtual bool StreamDataLeft();
	virtual bool StreamClosed();

private:
	IOStream &mrSource;
	int mBytesLeftInCurrentBlock;
	bool mFinished;
};

#endif // PROTOCOLUNCERTAINSTREAM__H