MCPcopy Create free account
hub / github.com/LAStools/LAStools / switch

Method switch

src/json.hpp:18417–18598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18415 const auto byte = static_cast<std::uint8_t>(s[i]);
18416
18417 switch (decode(state, codepoint, byte))
18418 {
18419 case UTF8_ACCEPT: // decode found a new code point
18420 {
18421 switch (codepoint)
18422 {
18423 case 0x08: // backspace
18424 {
18425 string_buffer[bytes++] = '\\';
18426 string_buffer[bytes++] = 'b';
18427 break;
18428 }
18429
18430 case 0x09: // horizontal tab
18431 {
18432 string_buffer[bytes++] = '\\';
18433 string_buffer[bytes++] = 't';
18434 break;
18435 }
18436
18437 case 0x0A: // newline
18438 {
18439 string_buffer[bytes++] = '\\';
18440 string_buffer[bytes++] = 'n';
18441 break;
18442 }
18443
18444 case 0x0C: // formfeed
18445 {
18446 string_buffer[bytes++] = '\\';
18447 string_buffer[bytes++] = 'f';
18448 break;
18449 }
18450
18451 case 0x0D: // carriage return
18452 {
18453 string_buffer[bytes++] = '\\';
18454 string_buffer[bytes++] = 'r';
18455 break;
18456 }
18457
18458 case 0x22: // quotation mark
18459 {
18460 string_buffer[bytes++] = '\\';
18461 string_buffer[bytes++] = '\"';
18462 break;
18463 }
18464
18465 case 0x5C: // reverse solidus
18466 {
18467 string_buffer[bytes++] = '\\';
18468 string_buffer[bytes++] = '\\';
18469 break;
18470 }
18471
18472 default:
18473 {
18474 // escape control characters (0x00..0x1F) or, if

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected