61 <<
"Unexpected end tag " <<
m_tagTitle <<
" found near line "
64 <<
"Will terminate execution!" << endl;
68 while (
m_line.find(
"<" ) ==
71 if ( !std::getline(
m_fin, addLine ) )
78 unsigned int startTag;
80 unsigned int endTagTitle;
82 startTag =
m_line.find(
"<" );
84 if (
m_line[startTag + 1] ==
86 while (
m_line.find(
"?>", startTag ) == std::string::npos ) {
88 if ( !std::getline(
m_fin, addLine ) )
94 endTag =
m_line.find(
"?>", startTag );
97 }
else if (
m_line[startTag + 1] ==
99 while (
m_line.find(
"-->", startTag ) == std::string::npos ) {
101 if ( !std::getline(
m_fin, addLine ) )
107 endTag =
m_line.find(
"-->", startTag );
114 while (
m_line.find(
">", startTag ) ==
115 std::string::npos ) {
117 if ( !std::getline(
m_fin, addLine ) )
123 endTag =
m_line.find(
">", startTag );
125 if (
m_line.find(
"/>", startTag ) < endTag ) {
130 if (
m_line.find(
" ", startTag ) != std::string::npos &&
131 m_line.find(
" ", startTag ) <
133 endTagTitle =
m_line.find(
" ", startTag );
135 endTagTitle = endTag;
139 m_tag =
m_line.substr( startTag + 1, endTag - startTag - 1 );
160 std::string defaultValue )
162 std::string whitespace =
" \t\n\v\f\r";
163 for (
unsigned int i = 0; i < whitespace.size(); i++ ) {
165 std::string attName = whitespace[i] + attribute +
"=";
166 if (
m_tag.find( attName ) != std::string::npos ) {
167 int startAttri =
m_tag.find( attName );
168 int startQuote =
m_tag.find(
"\"", startAttri + 1 );
169 int endQuote =
m_tag.find(
"\"", startQuote + 1 );
170 return m_tag.substr( startQuote + 1, endQuote - startQuote - 1 );
228 while ( str.find(
'$' ) != std::string::npos ) {
229 size_t varStart = str.find(
'$' );
230 size_t varNameLength;
234 if ( varStart == str.length() - 1 ) {
235 str.erase( varStart );
239 if ( str[varStart + 1] ==
'{' ) {
241 size_t braceStart = varStart + 1;
242 size_t braceEnd = str.find(
'}', braceStart );
244 if ( braceEnd == std::string::npos ) {
246 <<
"Incomplete environment variable found in text: " << str
249 <<
"Will terminate execution!" << endl;
253 varName = str.substr( braceStart + 1, braceEnd - braceStart - 1 );
254 varNameLength = braceEnd - varStart;
260 while ( varNameLength + varStart + 1 < str.length() &&
261 isAlphaNum( str[varStart + varNameLength + 1] ) ) {
265 varName = str.substr( varStart + 1, varNameLength );
268 char* envVar = getenv( varName.c_str() );
271 str.replace( varStart, varNameLength + 1, envVar );
274 <<
"Undefined environment variable found in text: " << varName
276 str.replace( varStart, varNameLength + 1,
"" );