| 36 | } |
| 37 | |
| 38 | void VariableHandler::replaceVariables(tstring &source) |
| 39 | { |
| 40 | tstring::size_type startPos, endPos; |
| 41 | startPos = 0; |
| 42 | endPos = tstring::npos; |
| 43 | |
| 44 | do |
| 45 | { |
| 46 | startPos = source.find(_T('$'), startPos); |
| 47 | if (startPos != tstring::npos) |
| 48 | { |
| 49 | endPos = source.find(_T('$'), startPos + 1); |
| 50 | if (endPos == tstring::npos) |
| 51 | break; |
| 52 | } |
| 53 | |
| 54 | if (endPos != tstring::npos) |
| 55 | { |
| 56 | tstring varValue = (*_variables)[source.substr(startPos + 1, endPos - startPos - 1)]; |
| 57 | source.replace(startPos, endPos - startPos + 1, varValue); |
| 58 | startPos = startPos + varValue.size(); |
| 59 | endPos = tstring::npos; |
| 60 | } |
| 61 | |
| 62 | |
| 63 | } while(startPos != tstring::npos); |
| 64 | |
| 65 | |
| 66 | |
| 67 | } |
| 68 | |
| 69 | |
| 70 | const tstring& VariableHandler::getVariable(const TCHAR* variableName) |