00001 #ifndef STDIOPARSERINPUT_H 00002 #define STDIOPARSERINPUT_H 00003 00008 /* 00009 * Copyright (C) 2003,2004,2005 Enrico Zini <enrico@debian.org> 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free Software 00023 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00024 */ 00025 00026 #include <tagcoll/ParserBase.h> 00027 #include <stdio.h> 00028 00029 #include <string> 00030 00031 namespace Tagcoll { 00032 00036 class StdioParserInput : public ParserInput 00037 { 00038 protected: 00039 std::string _file; 00040 int _line; 00041 FILE* _in; 00042 bool _close_on_exit; 00043 00044 public: 00045 StdioParserInput(FILE* in, const std::string& fname, int line = 1) throw (); 00046 StdioParserInput(const std::string& fname) throw (FileException); 00047 virtual ~StdioParserInput() throw (); 00048 00049 virtual const std::string& fileName() const throw () { return _file; } 00050 virtual int lineNumber() const throw () { return _line; } 00051 00052 virtual int nextChar() throw (ParserInputException); 00053 virtual void pushChar(int c) throw (ParserInputException); 00054 }; 00055 00056 } 00057 00058 // vim:set ts=4 sw=4: 00059 #endif