#include <mealMasterCompiler.hpp>

Public Member Functions | |
| MealMasterCompiler (int _maxRecipes=-1, MealMasterParseErrorHandlerPtr _parseErrorHandler=MealMasterParseErrorHandlerPtr(new MealMasterParseErrorHandler)) | |
| virtual | ~MealMasterCompiler (void) |
| Destructor. | |
| virtual void | translate (std::istream &inputStream, std::ostream &outputStream) const throw (Error) |
| void | setParseErrorHandler (MealMasterParseErrorHandlerPtr _parseErrorHandler) |
Data Fields | |
| std::map < std::string, std::string > | inverseUnitMap |
Static Public Attributes | |
| static MealMasterCompiler * | current = NULL |
Protected Attributes | |
| int | maxRecipes |
| MealMasterParseErrorHandlerPtr | parseErrorHandler |
At any time there must only be one instance of this class.
See description of Mealmaster file-format for more information.
Definition at line 38 of file mealMasterCompiler.hpp.
| MealMasterCompiler::MealMasterCompiler | ( | int | _maxRecipes = -1, |
|
| MealMasterParseErrorHandlerPtr | _parseErrorHandler = MealMasterParseErrorHandlerPtr( new MealMasterParseErrorHandler ) | |||
| ) |
Constructor. It is possible to limit the number of recipes, which will be parsed by a call of translate. This is necessary, if this compiler is used in a chain with a XSL translator, which will store all data in memory before processing it.
| _maxRecipes | Maximum recipes to parse. Abort afterwards. | |
| _parseErrorHandler | Error handler for parse errors. |
StoreErroneousHandler
Definition at line 105 of file mealMasterCompiler.cpp.
References lineNo.
00105 : 00106 inverseUnitMap( createInverseUnitMap() ), maxRecipes(_maxRecipes), 00107 parseErrorHandler(_parseErrorHandler) 00108 { 00109 assert( current == NULL ); 00110 current = this; 00111 00112 // Restart line-number counting. 00113 lineNo = 1; 00114 }
| MealMasterCompiler::~MealMasterCompiler | ( | void | ) | [virtual] |
Destructor.
Definition at line 116 of file mealMasterCompiler.cpp.
References current.
00117 { 00118 current = NULL; 00119 }
| virtual void MealMasterCompiler::translate | ( | std::istream & | inputStream, | |
| std::ostream & | outputStream | |||
| ) | const throw (Error) [virtual] |
Translate recipes. If the number of recipes, to be read, was limited by specifying _maxRecipes with the constructor, the stream will be repositioned (because flex usually will have read ahead, to fill its buffer).
The lexer keeps track of its read-position. This was implemented using the YY_USER_ACTION macro of flex. Note that the input-position will also change, when yymore(), yyless(), unput(), input() or REJECT are executed.
If no maximum number of recipes was specified in the constructor, the inputStream will be parsed up to its end.
| inputStream | Input stream to read mealmaster data from. | |
| outputStream | Output stream to write XML data to. |
Implements Compiler.
| void MealMasterCompiler::setParseErrorHandler | ( | MealMasterParseErrorHandlerPtr | _parseErrorHandler | ) | [inline] |
Definition at line 80 of file mealMasterCompiler.hpp.
References parseErrorHandler.
00081 { parseErrorHandler = _parseErrorHandler; }
MealMasterCompiler * MealMasterCompiler::current = NULL [static] |
| std::map< std::string, std::string > MealMasterCompiler::inverseUnitMap |
Definition at line 78 of file mealMasterCompiler.hpp.
int MealMasterCompiler::maxRecipes [protected] |
Definition at line 84 of file mealMasterCompiler.hpp.