Debian Codegraph @

utils/datafile.h

raw
1 /* This file is part of the skol suite.
2 Copyright (C) 2005, 2008, 2009 Mikael Djurfeldt
3
4 The skol suite is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 3, or (at
7 your option) any later version.
8
9 The skol suite is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with the skol suite; see the file COPYING. If not, write to
16 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
18
19
20 #ifndef DATAFILE_H
21
22 #include <string>
23 #include <fstream>
24
25 class Datafile : public std::ifstream {
26 protected:
27 bool atHeaderLine ();
28 bool scanLine (const char* pattern);
29 public:
30 Datafile (std::string filename) : std::ifstream (filename.data ()) { }
31 void ignoreLine ();
32 void ignoreWhitespace ();
33 bool read (const char*, int& x);
34 bool read (const char*, double& x);
35 void skipHeader ();
36 };
37 #define DATAFILE_H
38 #endif