summaryrefslogtreecommitdiff
path: root/Source/Library/Common/StringStream.class.cpp
blob: c4377ceb8a914a802e2b5053a29fff44e1669ae4 (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
#include "StringStream.class.h"

StringIStream::StringIStream(const String &e) {
	m_elements = new SimpleList<String>(e);
}

StringIStream::StringIStream() {
	m_elements = 0;
}

StringIStream::~StringIStream() {
	if (m_elements != 0) delete m_elements;
}

String StringIStream::read() {
	if (m_elements == 0) return "";
	String ret = m_elements->v();
	m_elements = m_elements->delThis();
	return ret;
}

void StringIStream::append(const String &e) {
	if (m_elements == 0) {
		m_elements = new SimpleList<String>(e);
	} else {
		m_elements->addAtEnd(e);
	}
}