MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / switch

Method switch

include/behaviortree_cpp/contrib/json.hpp:18413–18594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected