| 379 | } |
| 380 | |
| 381 | static int hexValue(char c) { |
| 382 | static char const digits[] = "0123456789ABCDEF"; |
| 383 | |
| 384 | if (c >= 'a' && c <= 'f') |
| 385 | c -= ('a' - 'A'); |
| 386 | |
| 387 | int value = std::find(digits, digits + 16, c) - digits; |
| 388 | if (value >= 16) { |
| 389 | throw std::runtime_error("hexValue"); |
| 390 | } |
| 391 | return value; |
| 392 | } |
| 393 | |
| 394 | // Does not handle "raw" form (e.g. #28C4D1), only escaped text |
| 395 | static std::string de4514(std::string const& input, int start, int& out_end) { |