MCPcopy Create free account
hub / github.com/SICKAG/sick_scan_xd / writeValue

Method writeValue

test/docker/jsoncpp/src/lib_json/json_writer.cpp:381–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381void FastWriter::writeValue(const Value& value) {
382 switch (value.type()) {
383 case nullValue:
384 if (!dropNullPlaceholders_)
385 document_ += "null";
386 break;
387 case intValue:
388 document_ += valueToString(value.asLargestInt());
389 break;
390 case uintValue:
391 document_ += valueToString(value.asLargestUInt());
392 break;
393 case realValue:
394 document_ += valueToString(value.asDouble());
395 break;
396 case stringValue: {
397 // Is NULL possible for value.string_? No.
398 char const* str;
399 char const* end;
400 bool ok = value.getString(&str, &end);
401 if (ok)
402 document_ += valueToQuotedStringN(str, static_cast<size_t>(end - str));
403 break;
404 }
405 case booleanValue:
406 document_ += valueToString(value.asBool());
407 break;
408 case arrayValue: {
409 document_ += '[';
410 ArrayIndex size = value.size();
411 for (ArrayIndex index = 0; index < size; ++index) {
412 if (index > 0)
413 document_ += ',';
414 writeValue(value[index]);
415 }
416 document_ += ']';
417 } break;
418 case objectValue: {
419 Value::Members members(value.getMemberNames());
420 document_ += '{';
421 for (auto it = members.begin(); it != members.end(); ++it) {
422 const String& name = *it;
423 if (it != members.begin())
424 document_ += ',';
425 document_ += valueToQuotedStringN(name.data(), name.length());
426 document_ += yamlCompatibilityEnabled_ ? ": " : ":";
427 writeValue(value[name]);
428 }
429 document_ += '}';
430 } break;
431 }
432}
433
434// Class StyledWriter
435// //////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 15

valueToStringFunction · 0.85
valueToQuotedStringNFunction · 0.85
valueToQuotedStringFunction · 0.85
asLargestIntMethod · 0.80
asLargestUIntMethod · 0.80
asDoubleMethod · 0.80
getStringMethod · 0.80
asBoolMethod · 0.80
getMemberNamesMethod · 0.80
beginMethod · 0.80
dataMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected