"cacheflow/git@developer.sourcefind.cn:SIYIXNI/vllm.git" did not exist on "e5464ee484450c2671dd0226516c99c60ce70d9d"
stream.cpp 812 Bytes
Newer Older
1
#include "crt.h"
Jesse Beder's avatar
Jesse Beder committed
2
#include "stream.h"
3
#include <iostream>
4
5
6

namespace YAML
{
Jesse Beder's avatar
Jesse Beder committed
7
8
9
10
11
12
13
14
15
16
17
18
19
	int Stream::pos() const
	{
		return input.tellg();
	}
	
	char Stream::peek()
	{
		return input.peek();
	}
	
	Stream::operator bool()
	{
		return input.good();
20
	}
Jesse Beder's avatar
Jesse Beder committed
21

22
	// get
23
	// . Extracts a character from the stream and updates our position
24
	char Stream::get()
25
26
27
28
29
30
31
32
33
34
	{
		char ch = input.get();
		column++;
		if(ch == '\n') {
			column = 0;
			line++;
		}
		return ch;
	}

35
	// get
36
	// . Extracts 'n' characters from the stream and updates our position
37
	std::string Stream::get(int n)
38
39
40
	{
		std::string ret;
		for(int i=0;i<n;i++)
41
			ret += get();
42
43
44
		return ret;
	}

45
	// eat
46
	// . Eats 'n' characters and updates our position.
47
	void Stream::eat(int n)
48
49
	{
		for(int i=0;i<n;i++)
50
			get();
Jesse Beder's avatar
Jesse Beder committed
51
52
	}

53
}