summaryrefslogtreecommitdiff
path: root/Source/Library/Common/IStream.proto.h
blob: e844726ad96aa89bb81007c334943a891b06cdb0 (plain) (blame)
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
#ifndef DEF_ISTREAM_PROTO_h
#define DEF_ISTREAM_PROTO_h

#include <String.class.h>
#include <SimpleList.class.h>
#include <Mutex.class.h>

class IStream : private Mutex {
	private:
	SimpleList<String> *m_buffer;
	int m_ptr;
	void operator =(IStream& other);
	bool m_eof;

	bool populate();

	protected:
	virtual String read() = 0;

	public:
	IStream();
	IStream(const IStream& other);
	virtual ~IStream();

	bool eof() const { return m_eof && (m_buffer == NULL); }

	WChar getChar();
	String get(WChar delimiter = "\n");
	String getWord() { return get(" "); }
};

#endif