stream.cpp 610 Bytes
Newer Older
1
#include "crt.h"
2
3
4
5
#include "stream.h"

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

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

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