MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / _parse_string

Function _parse_string

externals/picojson/picojson.h:779–818  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

777}
778
779template <typename String, typename Iter> inline bool _parse_string(String &out, input<Iter> &in) {
780 while (1) {
781 int ch = in.getc();
782 if (ch < ' ') {
783 in.ungetc();
784 return false;
785 } else if (ch == '"') {
786 return true;
787 } else if (ch == '\\') {
788 if ((ch = in.getc()) == -1) {
789 return false;
790 }
791 switch (ch) {
792#define MAP(sym, val) \
793 case sym: \
794 out.push_back(val); \
795 break
796 MAP('"', '\"');
797 MAP('\\', '\\');
798 MAP('/', '/');
799 MAP('b', '\b');
800 MAP('f', '\f');
801 MAP('n', '\n');
802 MAP('r', '\r');
803 MAP('t', '\t');
804#undef MAP
805 case 'u':
806 if (!_parse_codepoint(out, in)) {
807 return false;
808 }
809 break;
810 default:
811 return false;
812 }
813 } else {
814 out.push_back(static_cast<char>(ch));
815 }
816 }
817 return false;
818}
819
820template <typename Context, typename Iter> inline bool _parse_array(Context &ctx, input<Iter> &in) {
821 if (!ctx.parse_array_start()) {

Callers 3

_parse_objectFunction · 0.85
parse_stringMethod · 0.85
parse_stringMethod · 0.85

Calls 4

_parse_codepointFunction · 0.85
getcMethod · 0.80
ungetcMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected