Translates a variable definition. More...
#include <TranslatorVariable.h>
Public Member Functions | |
TranslatorVariable (const string &fname, size_t lineno, const string &text) | |
Constructor. More... | |
const string | translate (TranslationContext &context) override |
Translates a variable definition. More... | |
Private Attributes | |
string | m_fname |
Source file name containing input text. More... | |
size_t | m_lineno |
Starting offset within m_fname of input text. More... | |
string | m_text |
Text of variable definition. More... | |
Translates a variable definition.
Definition at line 43 of file TranslatorVariable.h.
|
inline |
Constructor.
fname | Filename of source file containing variable definition |
lineno | Line number within source file of variable definition text |
text | Text of variable definition |
Definition at line 50 of file TranslatorVariable.h.
|
overridevirtual |
Translates a variable definition.
This method translates a global variable definition of the form:
CONFIG_FILE="/root/hypertable.cfg"
Into the following
CONFIG_FILE=${CONFIG_FILE:-"/root/hypertable.cfg"}
This allow variables to be overriden by environment variables. As a side effect, it inserts the variable name into the context.symbols
map, mapping it to the variable value.
context | Context object containing symbol tables |
Implements Hypertable::ClusterDefinitionFile::Translator.
Definition at line 42 of file TranslatorVariable.cc.
|
private |
Source file name containing input text.
Definition at line 71 of file TranslatorVariable.h.
|
private |
Starting offset within m_fname of input text.
Definition at line 73 of file TranslatorVariable.h.
|
private |
Text of variable definition.
Definition at line 75 of file TranslatorVariable.h.