Main | License | Installation | FAQ | Screenshots | Contact | Links | Sf.net | Freshmeat.net | KDE-Apps.org
Requirements | Design | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

MealMasterCompiler Class Reference
[Compilers]

#include <mealMasterCompiler.hpp>

Inheritance diagram for MealMasterCompiler:

Inheritance graph
[legend]

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

Detailed Description

Scanner for converting Mealmaster recipes to XML. This class converts the contents of the input to XML and writes it to the output-stream.

At any time there must only be one instance of this class.

See description of Mealmaster file-format for more information.

Date:
Thu Mar 28 2005
Author:
Jan Wedekind (wedesoft@users.sourceforge.net)

Definition at line 38 of file mealMasterCompiler.hpp.


Constructor & Destructor Documentation

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.

Parameters:
_maxRecipes Maximum recipes to parse. Abort afterwards.
_parseErrorHandler Error handler for parse errors.
See also:
MealMasterParseErrorHandler

StoreErroneousHandler

XSLCompiler

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 }


Member Function Documentation

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.

Parameters:
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; }


Field Documentation

MealMasterCompiler * MealMasterCompiler::current = NULL [static]

Definition at line 76 of file mealMasterCompiler.hpp.

Referenced by ~MealMasterCompiler().

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.

MealMasterParseErrorHandlerPtr MealMasterCompiler::parseErrorHandler [protected]

Definition at line 86 of file mealMasterCompiler.hpp.

Referenced by setParseErrorHandler().


The documentation for this class was generated from the following files:

anymeal 0.30 - recipe management software - Make the most of your food! - © Jan Wedekind Sun Sep 14 16:01:29 2008 - GNU Free Documentation License