Switched to reading the entire file into a buffer at the start.\nThis speeds it up a TON (like 100x).

This commit is contained in:
Jesse Beder
2009-02-01 20:48:43 +00:00
parent a6d5902ebf
commit f9c0725684
9 changed files with 72 additions and 75 deletions

View File

@@ -5,21 +5,24 @@
namespace YAML
{
struct Stream
class Stream
{
Stream(std::istream& input_): input(input_), line(0), column(0) {}
public:
Stream(std::istream& input);
~Stream();
int pos() const;
operator bool();
bool operator !() { return !(*this); }
operator bool() const;
bool operator !() const { return !static_cast <bool>(*this); }
std::istream& stream() const { return input; }
const char *current() const { return buffer + pos; }
char peek();
char get();
std::string get(int n);
void eat(int n = 1);
std::istream& input;
int line, column;
int pos, line, column, size;
private:
char *buffer;
};
}