MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / switch

Method switch

Source/external/json.hpp:18289–18470  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18287 const auto byte = static_cast<std::uint8_t>(s[i]);
18288
18289 switch (decode(state, codepoint, byte))
18290 {
18291 case UTF8_ACCEPT: // decode found a new code point
18292 {
18293 switch (codepoint)
18294 {
18295 case 0x08: // backspace
18296 {
18297 string_buffer[bytes++] = '\\';
18298 string_buffer[bytes++] = 'b';
18299 break;
18300 }
18301
18302 case 0x09: // horizontal tab
18303 {
18304 string_buffer[bytes++] = '\\';
18305 string_buffer[bytes++] = 't';
18306 break;
18307 }
18308
18309 case 0x0A: // newline
18310 {
18311 string_buffer[bytes++] = '\\';
18312 string_buffer[bytes++] = 'n';
18313 break;
18314 }
18315
18316 case 0x0C: // formfeed
18317 {
18318 string_buffer[bytes++] = '\\';
18319 string_buffer[bytes++] = 'f';
18320 break;
18321 }
18322
18323 case 0x0D: // carriage return
18324 {
18325 string_buffer[bytes++] = '\\';
18326 string_buffer[bytes++] = 'r';
18327 break;
18328 }
18329
18330 case 0x22: // quotation mark
18331 {
18332 string_buffer[bytes++] = '\\';
18333 string_buffer[bytes++] = '\"';
18334 break;
18335 }
18336
18337 case 0x5C: // reverse solidus
18338 {
18339 string_buffer[bytes++] = '\\';
18340 string_buffer[bytes++] = '\\';
18341 break;
18342 }
18343
18344 default:
18345 {
18346 // escape control characters (0x00..0x1F) or, if

Callers

nothing calls this directly

Calls 5

createFunction · 0.85
concatFunction · 0.85
hex_bytesFunction · 0.85
sizeMethod · 0.80
to_stringFunction · 0.70

Tested by

no test coverage detected