0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
Hypertable::ClusterDefinitionFile::TranslatorVariable Class Reference

Translates a variable definition. More...

#include <TranslatorVariable.h>

Inheritance diagram for Hypertable::ClusterDefinitionFile::TranslatorVariable:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::ClusterDefinitionFile::TranslatorVariable:
Collaboration graph
[legend]

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...
 

Detailed Description

Translates a variable definition.

Definition at line 43 of file TranslatorVariable.h.

Constructor & Destructor Documentation

Hypertable::ClusterDefinitionFile::TranslatorVariable::TranslatorVariable ( const string &  fname,
size_t  lineno,
const string &  text 
)
inline

Constructor.

Parameters
fnameFilename of source file containing variable definition
linenoLine number within source file of variable definition text
textText of variable definition

Definition at line 50 of file TranslatorVariable.h.

Member Function Documentation

const string TranslatorVariable::translate ( TranslationContext context)
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.

Parameters
contextContext object containing symbol tables
Returns
Translated variable definition statement

Implements Hypertable::ClusterDefinitionFile::Translator.

Definition at line 42 of file TranslatorVariable.cc.

Member Data Documentation

string Hypertable::ClusterDefinitionFile::TranslatorVariable::m_fname
private

Source file name containing input text.

Definition at line 71 of file TranslatorVariable.h.

size_t Hypertable::ClusterDefinitionFile::TranslatorVariable::m_lineno
private

Starting offset within m_fname of input text.

Definition at line 73 of file TranslatorVariable.h.

string Hypertable::ClusterDefinitionFile::TranslatorVariable::m_text
private

Text of variable definition.

Definition at line 75 of file TranslatorVariable.h.


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