MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / _parse_string

Function _parse_string

libraries/AP_JSON/AP_JSON.cpp:490–525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490template <typename String, typename Iter> bool _parse_string(String &out, input<Iter> &in)
491{
492 while (1) {
493 int ch = in.getc();
494 if (ch < ' ') {
495 in.ungetc();
496 return false;
497 } else if (ch == '"') {
498 return true;
499 } else if (ch == '\\') {
500 if ((ch = in.getc()) == -1) {
501 return false;
502 }
503 switch (ch) {
504#define MAP(sym, val) \
505 case sym: \
506 out.push_back(val); \
507 break
508 MAP('"', '\"');
509 MAP('\\', '\\');
510 MAP('/', '/');
511 MAP('b', '\b');
512 MAP('f', '\f');
513 MAP('n', '\n');
514 MAP('r', '\r');
515 MAP('t', '\t');
516#undef MAP
517 default:
518 return false;
519 }
520 } else {
521 out.push_back(static_cast<char>(ch));
522 }
523 }
524 return false;
525}
526
527template <typename Context, typename Iter> bool _parse_array(Context &ctx, input<Iter> &in)
528{

Callers 2

_parse_objectFunction · 0.85
parse_stringMethod · 0.85

Calls 2

getcMethod · 0.80
ungetcMethod · 0.80

Tested by

no test coverage detected