stream.cpp 592 Bytes
Newer Older
1
2
3
4
#include "stream.h"

namespace YAML
{
5
	// get
6
	// . Extracts a character from the stream and updates our position
7
	char Stream::get()
8
9
10
11
12
13
14
15
16
17
	{
		char ch = input.get();
		column++;
		if(ch == '\n') {
			column = 0;
			line++;
		}
		return ch;
	}

18
	// get
19
	// . Extracts 'n' characters from the stream and updates our position
20
	std::string Stream::get(int n)
21
22
23
	{
		std::string ret;
		for(int i=0;i<n;i++)
24
			ret += get();
25
26
27
		return ret;
	}

28
	// eat
29
	// . Eats 'n' characters and updates our position.
30
	void Stream::eat(int n)
31
32
	{
		for(int i=0;i<n;i++)
33
			get();
34
35
	}
}