#ifndef __SITECING_SITECING_ENFLESHER_H #define __SITECING_SITECING_ENFLESHER_H #include #include using namespace std; /** * @file * @brief The preprocessed source builder. */ #ifndef sitecing_enflesher_flexlexer_once #define sitecing_enflesher_flexlexer_once #undef yyFlexLexer /** * nevermind me */ #define yyFlexLexer sitecing_enflesherFlexLexer #include #undef yyFlexLexerOnce #endif class sitecing_parser; /** * The enfleshing of the skeleton file according to the in-memory parsed * component source. */ class sitecing_enflesher : public sitecing_enflesherFlexLexer { public: /** * It is time to anchor output with the \#line directive. */ bool anchor_time; /** * The file currently being written is supposed to have \#line * directives all around the place. */ bool anchoraged; /** * The reference to the parser object containg the parsed source. */ sitecing_parser& parser; /** * The output stream. */ ofstream outs; /** * the outs stream destination file. * @see outs */ string outs_filename; /** * @param p The parser object containing preparsed data. */ sitecing_enflesher(sitecing_parser& p) : parser(p), anchor_time(true) { } /** * Do the job. */ void enflesh(); /** * Output parsed data * @param buf pointer to the data * @param size length of the buffer pointed by buf */ virtual void LexerOutput(const char *buf,int size); /** * Lexer generated by flex * @return zero on success */ virtual int yylex(); /** * Put a \#line anchor into output. */ void anchor(); /** * Close previously opened output stream, rename to the 'correct' * destination filename, if needed, and open new file. * @see outs * @see outs_filename * @see outs_close */ void outs_open(const string& nfile); /** * Close previously opened output stream, and rename to the 'correct' * destination filename, if needed. * @see outs_open * @see outs * @see outs_filename */ void outs_close(); }; #endif /* __SITECING_SITECING_ENFLESHER_H */