-/*
-This file is part of libmspparser
-Copyright © 2006 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
#include "input.h"
namespace Msp {
-namespace Parser {
+namespace DataFile {
-Input::Input(std::istream &i):
+Input::Input(IO::Base &i):
in(i),
line(1),
next(-1)
int Input::get()
{
- int c=next;
- next=-1;
- if(c<0) c=in.get();
+ int c = next;
+ next = -1;
+ if(c<0) c = in.get();
if(c=='\n')
++line;
int Input::peek()
{
if(next<0)
- next=in.get();
+ next = in.get();
return next;
}
-} // namespace Parser
+Input::operator bool() const
+{
+ return next>=0 || !in.eof();
+}
+
+} // namespace DataFile
} // namespace Msp