Moved the input stream, together with line/column info, into its own class, which allowed some other stuff just to pass the stream, and not have to be a member of Scanner.

This commit is contained in:
Jesse Beder 2008-06-29 06:32:13 +00:00
parent 0d5a97bffe
commit ff99f85a6d
13 changed files with 162 additions and 142 deletions

26
stream.h Normal file
View file

@ -0,0 +1,26 @@
#pragma once
#include <ios>
#include <string>
namespace YAML
{
struct Stream
{
Stream(std::istream& input_): input(input_), line(0), column(0) {}
char peek() { return input.peek(); }
int pos() const { return input.tellg(); }
operator std::istream& () { return input; }
operator bool() { return input.good(); }
bool operator !() { return !input; }
char GetChar();
std::string GetChar(int n);
void Eat(int n = 1);
void EatLineBreak();
std::istream& input;
int line, column;
};
}