MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / switch

Method switch

extern/json/json.hpp:18327–18508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18325 const auto byte = static_cast<std::uint8_t>(s[i]);
18326
18327 switch (decode(state, codepoint, byte))
18328 {
18329 case UTF8_ACCEPT: // decode found a new code point
18330 {
18331 switch (codepoint)
18332 {
18333 case 0x08: // backspace
18334 {
18335 string_buffer[bytes++] = '\\';
18336 string_buffer[bytes++] = 'b';
18337 break;
18338 }
18339
18340 case 0x09: // horizontal tab
18341 {
18342 string_buffer[bytes++] = '\\';
18343 string_buffer[bytes++] = 't';
18344 break;
18345 }
18346
18347 case 0x0A: // newline
18348 {
18349 string_buffer[bytes++] = '\\';
18350 string_buffer[bytes++] = 'n';
18351 break;
18352 }
18353
18354 case 0x0C: // formfeed
18355 {
18356 string_buffer[bytes++] = '\\';
18357 string_buffer[bytes++] = 'f';
18358 break;
18359 }
18360
18361 case 0x0D: // carriage return
18362 {
18363 string_buffer[bytes++] = '\\';
18364 string_buffer[bytes++] = 'r';
18365 break;
18366 }
18367
18368 case 0x22: // quotation mark
18369 {
18370 string_buffer[bytes++] = '\\';
18371 string_buffer[bytes++] = '\"';
18372 break;
18373 }
18374
18375 case 0x5C: // reverse solidus
18376 {
18377 string_buffer[bytes++] = '\\';
18378 string_buffer[bytes++] = '\\';
18379 break;
18380 }
18381
18382 default:
18383 {
18384 // escape control characters (0x00..0x1F) or, if

Callers

nothing calls this directly

Calls 6

hex_bytesFunction · 0.85
createFunction · 0.70
concatFunction · 0.70
to_stringFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected