MCPcopy Create free account
hub / github.com/Illumina/paragraph / writeValue

Method writeValue

external/jsoncpp/jsoncpp.cpp:4498–4550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4496}
4497
4498void FastWriter::writeValue(const Value& value) {
4499 switch (value.type()) {
4500 case nullValue:
4501 if (!dropNullPlaceholders_)
4502 document_ += "null";
4503 break;
4504 case intValue:
4505 document_ += valueToString(value.asLargestInt());
4506 break;
4507 case uintValue:
4508 document_ += valueToString(value.asLargestUInt());
4509 break;
4510 case realValue:
4511 document_ += valueToString(value.asDouble());
4512 break;
4513 case stringValue:
4514 {
4515 // Is NULL possible for value.string_? No.
4516 char const* str;
4517 char const* end;
4518 bool ok = value.getString(&str, &end);
4519 if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
4520 break;
4521 }
4522 case booleanValue:
4523 document_ += valueToString(value.asBool());
4524 break;
4525 case arrayValue: {
4526 document_ += '[';
4527 ArrayIndex size = value.size();
4528 for (ArrayIndex index = 0; index < size; ++index) {
4529 if (index > 0)
4530 document_ += ',';
4531 writeValue(value[index]);
4532 }
4533 document_ += ']';
4534 } break;
4535 case objectValue: {
4536 Value::Members members(value.getMemberNames());
4537 document_ += '{';
4538 for (Value::Members::iterator it = members.begin(); it != members.end();
4539 ++it) {
4540 const JSONCPP_STRING& name = *it;
4541 if (it != members.begin())
4542 document_ += ',';
4543 document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
4544 document_ += yamlCompatibilityEnabled_ ? ": " : ":";
4545 writeValue(value[name]);
4546 }
4547 document_ += '}';
4548 } break;
4549 }
4550}
4551
4552// Class StyledWriter
4553// //////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected