#include <writer.hh>
Inheritance diagram for Writer:
Protected Methods | |
Writer (PropRegistry ®istry_) | |
string | className2cc (const string &className) |
string | className2hh (const string &className) |
string | className2macro (const string &className) |
string | fullPath (const string &fileName) |
void | openStream (const string &fullPathName) |
void | closeStream () |
void | indent () |
void | unindent () |
ostream& | line (bool dumpSharpLine=false) |
ostream& | writeChunk (const CodeChunk &cc, const string &terminator="") |
Protected Attributes | |
ofstream | ofs |
PropRegistry& | registry |
Private Attributes | |
int | _line |
string | _file |
string | _indent |
The following registry keys are used, if found:
Definition at line 77 of file writer.hh.
|
|
|
Returns the name of the .cc file for a certain class name. By default, given a ClassNameLikeThis, it returns class_name_like_this.cc Definition at line 50 of file writer.cc. Referenced by LaParserWriter::writeParser(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Returns the name of the .hh file for a certain class name. By default, given a ClassNameLikeThis, it returns class_name_like_this.hh Definition at line 67 of file writer.cc. Referenced by LaParserWriter::writeParser(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Returns a string suitable for use in an ifndef multiple inclusino avoidance directive. Definition at line 83 of file writer.cc. Referenced by LaParserWriter::writeParser(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Returns the full path for a certain file name, that is the result of appending the file's name to the given destination directory where files should be put, if any. Definition at line 97 of file writer.cc. Referenced by LaParserWriter::writeParser(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
tries to open ofs for writing with the given file name. If it succedes, it also writes the "this file was generated by CppCC blah blah" starting comment into the file. If the open fails, it die()s. Additionally, it resetes the _indent level (just in case it was left in a messy state frmo a previous file:). Definition at line 105 of file writer.cc. Referenced by LaParserWriter::writeParser(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Closes the ofs strem, after adding an ending comment at the end fo the currently open file. Definition at line 128 of file writer.cc. Referenced by LaParserWriter::writeParser(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Definition at line 126 of file writer.hh. Referenced by LaEpDefWriter::operator()(), LaParserWriter::writeEbnf(), LaParserWriter::writeEbnfLa(), LaParserWriter::writeLaDefs(), LaParserWriter::writeParser(), LaParserWriter::writeProductionDefs(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Definition at line 131 of file writer.hh. Referenced by LaEpDefWriter::operator()(), LaParserWriter::writeEbnf(), LaParserWriter::writeEbnfLa(), LaParserWriter::writeLaDefs(), LaParserWriter::writeParser(), LaParserWriter::writeProductionDefs(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
Definition at line 137 of file writer.hh. Referenced by LaEpDefWriter::operator()(), LaEpDeclWriter::operator()(), LaParserWriter::writeEbnf(), LaParserWriter::writeEbnfLa(), LaParserWriter::writeLaDefs(), LaParserWriter::writeLaEpDecls(), LaParserWriter::writeParser(), LaParserWriter::writeProductionDecls(), LaParserWriter::writeProductionDefs(), LaParserWriter::writeProductionLaDecls(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
This method must be used or writing usercode stored in CodeChunk objects. If used consusently together with line() for normal output, it is able to dump the correct line directives (if the SHARP_LINES option is activated). For this the method relies on line() to be the only point where a new line is ever dumped into the output stream. At the end of the usercode chunk it will also append the terminator string (if any is given), BEFORE the line directive that switches back to the actual .cc file (this is because gcc seems to only report errors locations when it reaches the next token after the error's place, which may be already in the .ccalthough the error is from a usercode chunk). Of course, the terminator must not contain any newline characters. Definition at line 137 of file writer.cc. Referenced by LaParserWriter::makeLaCondition(), LaParserWriter::writeEbnf(), LaParserWriter::writeEbnfLa(), LaParserWriter::writeParser(), LaParserWriter::writeProductionDecls(), LaParserWriter::writeProductionDefs(), ScannerDfaWriter::writeScanner(), and TokenWriter::writeTokenClass().
|
|
The stream into which this writer dumps the data. We had to place it here (and not in derived classes) because it must be known to the line() method. |
|
|
|
|
|
|
|
This string defines our current _indentation level. |