| 181 | |
| 182 | template <class It1, class It2, class It3> |
| 183 | static inline It1 Quote(It1 to, It2 from, It3 end, const char* safe) { |
| 184 | bool escape_map[256]; |
| 185 | memcpy(escape_map, chars_to_url_escape, 256); |
| 186 | // RFC 3986 Uniform Resource Identifiers (URI): Generic Syntax |
| 187 | // lists following reserved characters: |
| 188 | const char* reserved = ":/?#[]@!$&\'()*+,;="; |
| 189 | for (const char* p = reserved; *p; ++p) { |
| 190 | escape_map[(unsigned char)*p] = true; |
| 191 | } |
| 192 | // characters we think are safe at the moment |
| 193 | for (const char* p = safe; *p; ++p) { |
| 194 | escape_map[(unsigned char)*p] = false; |
| 195 | } |
| 196 | |
| 197 | return Escape(to, from, end, escape_map); |
| 198 | } |
| 199 | |
| 200 | char* Quote(char* to, const char* from, const char* safe) { |
| 201 | return Quote(to, FixZero(from), TCStringEndIterator(), safe); |
no test coverage detected