00001 /* Copyright (C) 2002, 2003, 2004 Jan Wedekind. 00002 This file is part of the recipe database application AnyMeal. 00003 00004 AnyMeal is free software; you can redistribute it and/or modify it under 00005 the terms of the GNU GENERAL PUBLIC LICENSE as published by the Free 00006 Software Foundation; either version 3 of the License, or (at your option) 00007 any later version. 00008 00009 AnyMeal is distributed in the hope that it will be useful, but WITHOUT ANY 00010 WARRANTY; without even the implied warranty of MERCHANTIBILITY or FITNESS 00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00012 details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00016 #ifndef MEALMASTERCOMPILER_HPP 00017 #define MEALMASTERCOMPILER_HPP 00018 00019 #include <boost/shared_ptr.hpp> 00020 #include <map> 00021 #include <string> 00022 #include "compiler.hpp" 00023 #include "mealMasterParseErrorHandler.hpp" 00024 00038 class MealMasterCompiler: public Compiler 00039 { 00040 public: 00052 MealMasterCompiler( int _maxRecipes = -1, 00053 MealMasterParseErrorHandlerPtr _parseErrorHandler = 00054 MealMasterParseErrorHandlerPtr( new MealMasterParseErrorHandler ) ); 00056 virtual ~MealMasterCompiler(void); 00072 virtual void translate( std::istream &inputStream, 00073 std::ostream &outputStream ) const 00074 throw (Error); 00076 static MealMasterCompiler *current; 00078 std::map< std::string, std::string > inverseUnitMap; 00080 void setParseErrorHandler( MealMasterParseErrorHandlerPtr _parseErrorHandler ) 00081 { parseErrorHandler = _parseErrorHandler; } 00082 protected: 00084 int maxRecipes; 00086 MealMasterParseErrorHandlerPtr parseErrorHandler; 00087 }; 00088 00090 typedef boost::shared_ptr< MealMasterCompiler > MealMasterCompilerPtr; 00091 00093 00094 #endif