34 #include <boost/algorithm/string.hpp>
43 string translation_text;
44 size_t offset = m_text.find_first_of(
'=');
45 if (offset == string::npos)
47 (
int)m_lineno, m_fname.c_str());
48 string name = m_text.substr(0, offset);
50 string raw_value = m_text.substr(offset+1);
51 boost::trim(raw_value);
52 string preceding_whitespace;
53 bool preceding_newline=
false;
55 for (
const char *ptr = raw_value.c_str(); *ptr; ptr++) {
57 preceding_whitespace.append(1, *ptr);
59 preceding_newline =
true;
62 if (preceding_newline)
65 value.append(preceding_whitespace);
66 preceding_whitespace.clear();
67 preceding_newline =
false;
68 value.append(1, *ptr);
72 size_t whitespace_chars = 0;
73 for (
const char *ptr = m_text.c_str(); *ptr && isspace(*ptr); ptr++)
76 translation_text.append(m_text.c_str(), whitespace_chars);
77 translation_text.append(name);
78 translation_text.append(
"=${");
79 translation_text.append(name);
80 translation_text.append(
":-");
81 translation_text.append(value);
82 translation_text.append(
"}\n");
84 if (value.length() >= 2) {
85 if ((value[0] ==
'\'' && value[value.length()-1] ==
'\'') ||
86 (value[0] ==
'"' && value[value.length()-1] ==
'"'))
87 value = value.substr(1, value.length()-2);
90 return translation_text;
Declarations for TranslatorVariable.
Logging routines and macros.
Compatibility Macros for C/C++.
map< string, string > symbols
Map of variable names to default values.
#define HT_THROWF(_code_, _fmt_,...)
const string translate(TranslationContext &context) override
Translates a variable definition.
Context used to translate cluster definition statements.
Cluster definition file translation definitions.
Error codes, Exception handling, error logging.