MCPcopy Create free account
hub / github.com/Snapchat/Valdi / parseString

Method parseString

valdi_core/src/valdi_core/cpp/Utils/JSONReader.cpp:180–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180bool JSONReader::parseString(std::string& output) {
181 if (!_parser.parse('"')) {
182 return false;
183 }
184
185 auto p = position();
186 auto escaping = false;
187
188 while (escaping || !_parser.tryParse('"')) {
189 if (escaping) {
190 escaping = false;
191 } else {
192 if (_parser.peek('\\')) {
193 escaping = true;
194 }
195 }
196
197 if (!_parser.skip()) {
198 return false;
199 }
200 }
201
202 return decodeString(_parser.substr(p, position() - 1), output);
203}
204
205bool JSONReader::decodeString(std::string_view str, std::string& decoded) {
206 decoded.reserve(str.size());

Callers 3

readValueFromJSONReaderFunction · 0.80
parseHeapDumpMethod · 0.80
parseStringsMethod · 0.80

Calls 6

positionFunction · 0.85
skipMethod · 0.80
substrMethod · 0.80
parseMethod · 0.45
tryParseMethod · 0.45
peekMethod · 0.45

Tested by

no test coverage detected