| 207 | } |
| 208 | |
| 209 | bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType, |
| 210 | bool escapeNonAscii) { |
| 211 | if (flowType == FlowType::Flow) { |
| 212 | return false; |
| 213 | } |
| 214 | |
| 215 | // TODO: check for non-printable characters? |
| 216 | return std::none_of(str.begin(), str.end(), [=](char ch) { |
| 217 | return (escapeNonAscii && (0x80 <= static_cast<unsigned char>(ch))); |
| 218 | }); |
| 219 | } |
| 220 | |
| 221 | std::pair<uint16_t, uint16_t> EncodeUTF16SurrogatePair(int codePoint) { |
| 222 | const uint32_t leadOffset = 0xD800 - (0x10000 >> 10); |
no test coverage detected