-rw-r--r-- | include/sitecing/sitecing_enflesher.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/sitecing/sitecing_enflesher.h b/include/sitecing/sitecing_enflesher.h index 512a358..8bc43a0 100644 --- a/include/sitecing/sitecing_enflesher.h +++ b/include/sitecing/sitecing_enflesher.h | |||
@@ -1,66 +1,79 @@ | |||
1 | #ifndef __SITECING_SITECING_ENFLESHER_H | 1 | #ifndef __SITECING_SITECING_ENFLESHER_H |
2 | #define __SITECING_SITECING_ENFLESHER_H | 2 | #define __SITECING_SITECING_ENFLESHER_H |
3 | 3 | ||
4 | #include <fstream> | 4 | #include <fstream> |
5 | #include <string> | 5 | #include <string> |
6 | using namespace std; | 6 | using namespace std; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * @file | 9 | * @file |
10 | * @brief The preprocessed source builder. | 10 | * @brief The preprocessed source builder. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef sitecing_enflesher_flexlexer_once | 13 | #ifndef sitecing_enflesher_flexlexer_once |
14 | #define sitecing_enflesher_flexlexer_once | 14 | #define sitecing_enflesher_flexlexer_once |
15 | #undef yyFlexLexer | 15 | #undef yyFlexLexer |
16 | #define yyFlexLexer sitecing_enflesherFlexLexer | 16 | #define yyFlexLexer sitecing_enflesherFlexLexer |
17 | #include <FlexLexer.h> | 17 | #include <FlexLexer.h> |
18 | #undef yyFlexLexerOnce | 18 | #undef yyFlexLexerOnce |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | class sitecing_parser; | 21 | class sitecing_parser; |
22 | /** | 22 | /** |
23 | * The enfleshing of the skeleton file according to the in-memory parsed | 23 | * The enfleshing of the skeleton file according to the in-memory parsed |
24 | * component source. | 24 | * component source. |
25 | */ | 25 | */ |
26 | class sitecing_enflesher : public sitecing_enflesherFlexLexer { | 26 | class sitecing_enflesher : public sitecing_enflesherFlexLexer { |
27 | public: | 27 | public: |
28 | /** | 28 | /** |
29 | * It is time to anchor output with the #line directive. | 29 | * It is time to anchor output with the #line directive. |
30 | */ | 30 | */ |
31 | bool anchor_time; | 31 | bool anchor_time; |
32 | /** | 32 | /** |
33 | * The file currently being written is supposed to have #line | 33 | * The file currently being written is supposed to have #line |
34 | * directives all around the place. | 34 | * directives all around the place. |
35 | */ | 35 | */ |
36 | bool anchoraged; | 36 | bool anchoraged; |
37 | /** | 37 | /** |
38 | * The reference to the parser object containg the parsed source. | 38 | * The reference to the parser object containg the parsed source. |
39 | */ | 39 | */ |
40 | sitecing_parser& parser; | 40 | sitecing_parser& parser; |
41 | /** | 41 | /** |
42 | * The output stream. | 42 | * The output stream. |
43 | */ | 43 | */ |
44 | ofstream outs; | 44 | ofstream outs; |
45 | /** | ||
46 | * the outs stream destination file. | ||
47 | * @see outs | ||
48 | */ | ||
49 | string outs_filename; | ||
45 | 50 | ||
46 | /** | 51 | /** |
47 | * @param p The parser object containing preparsed data. | 52 | * @param p The parser object containing preparsed data. |
48 | */ | 53 | */ |
49 | sitecing_enflesher(sitecing_parser& p) | 54 | sitecing_enflesher(sitecing_parser& p) |
50 | : parser(p), anchor_time(true) { } | 55 | : parser(p), anchor_time(true) { } |
51 | 56 | ||
52 | /** | 57 | /** |
53 | * Do the job. | 58 | * Do the job. |
54 | */ | 59 | */ |
55 | void enflesh(); | 60 | void enflesh(); |
56 | 61 | ||
57 | virtual void LexerOutput(const char *buf,int size); | 62 | virtual void LexerOutput(const char *buf,int size); |
58 | virtual int yylex(); | 63 | virtual int yylex(); |
59 | 64 | ||
60 | /** | 65 | /** |
61 | * Put a #line anchor into output. | 66 | * Put a #line anchor into output. |
62 | */ | 67 | */ |
63 | void anchor(); | 68 | void anchor(); |
69 | |||
70 | /** | ||
71 | * Close previously opened output stream, rename to the 'correct' | ||
72 | * destination filename, if needed, and open new file. | ||
73 | * @see outs | ||
74 | * @see outs_filename | ||
75 | */ | ||
76 | void outs_open(const string& nfile); | ||
64 | }; | 77 | }; |
65 | 78 | ||
66 | #endif /* __SITECING_SITECING_ENFLESHER_H */ | 79 | #endif /* __SITECING_SITECING_ENFLESHER_H */ |