| 88 | } |
| 89 | |
| 90 | void escape(std::string &str, char toEscape) |
| 91 | { |
| 92 | //cannot escape string that contains the escaped sequence already because the mapping is not one-to-one anymore |
| 93 | std::string unescaped = str; |
| 94 | unescape(unescaped, toEscape); |
| 95 | if (unescaped != str) |
| 96 | { |
| 97 | throw std::exception(); |
| 98 | } |
| 99 | // |
| 100 | size_t pos; |
| 101 | std::string escaped = escapeCharacter(toEscape); |
| 102 | while ((pos = str.find(toEscape)) != std::string::npos) |
| 103 | { |
| 104 | str = str.replace(pos, 1, escaped); |
| 105 | } |
| 106 | |
| 107 | } |
| 108 | void unescape(std::string &str, char toUnescape) |
| 109 | { |
| 110 |
nothing calls this directly
no test coverage detected