]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/input.cpp
Style update: add spaces around assignments
[libs/datafile.git] / source / input.cpp
index 0f23bb29b9797bff09fc738dc52be6e7aeddf8e7..d74c8efde0a943fb8cdb11f8f4f3281f88d21d9a 100644 (file)
@@ -1,14 +1,15 @@
-/*
-This file is part of libmspparser
+/* $Id$
+
+This file is part of libmspdatafile
 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)
@@ -16,9 +17,9 @@ Input::Input(std::istream &i):
 
 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;
@@ -29,9 +30,14 @@ int Input::get()
 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