| 11 | namespace YAML { |
| 12 | namespace Exp { |
| 13 | unsigned ParseHex(const std::string& str, const Mark& mark) { |
| 14 | unsigned value = 0; |
| 15 | for (char ch : str) { |
| 16 | int digit = 0; |
| 17 | if ('a' <= ch && ch <= 'f') |
| 18 | digit = ch - 'a' + 10; |
| 19 | else if ('A' <= ch && ch <= 'F') |
| 20 | digit = ch - 'A' + 10; |
| 21 | else if ('0' <= ch && ch <= '9') |
| 22 | digit = ch - '0'; |
| 23 | else |
| 24 | throw ParserException(mark, ErrorMsg::INVALID_HEX); |
| 25 | |
| 26 | value = (value << 4) + digit; |
| 27 | } |
| 28 | |
| 29 | return value; |
| 30 | } |
| 31 | |
| 32 | std::string Str(unsigned ch) { return std::string(1, static_cast<char>(ch)); } |
| 33 |
no test coverage detected