MCPcopy Create free account
hub / github.com/Kitware/VTK / writeValue

Method writeValue

ThirdParty/jsoncpp/vtkjsoncpp/jsoncpp.cpp:4474–4525  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4472}
4473
4474void FastWriter::writeValue(const Value& value) {
4475 switch (value.type()) {
4476 case nullValue:
4477 if (!dropNullPlaceholders_)
4478 document_ += "null";
4479 break;
4480 case intValue:
4481 document_ += valueToString(value.asLargestInt());
4482 break;
4483 case uintValue:
4484 document_ += valueToString(value.asLargestUInt());
4485 break;
4486 case realValue:
4487 document_ += valueToString(value.asDouble());
4488 break;
4489 case stringValue: {
4490 // Is NULL possible for value.string_? No.
4491 char const* str;
4492 char const* end;
4493 bool ok = value.getString(&str, &end);
4494 if (ok)
4495 document_ += valueToQuotedStringN(str, static_cast<size_t>(end - str));
4496 break;
4497 }
4498 case booleanValue:
4499 document_ += valueToString(value.asBool());
4500 break;
4501 case arrayValue: {
4502 document_ += '[';
4503 ArrayIndex size = value.size();
4504 for (ArrayIndex index = 0; index < size; ++index) {
4505 if (index > 0)
4506 document_ += ',';
4507 writeValue(value[index]);
4508 }
4509 document_ += ']';
4510 } break;
4511 case objectValue: {
4512 Value::Members members(value.getMemberNames());
4513 document_ += '{';
4514 for (auto it = members.begin(); it != members.end(); ++it) {
4515 const String& name = *it;
4516 if (it != members.begin())
4517 document_ += ',';
4518 document_ += valueToQuotedStringN(name.data(), name.length());
4519 document_ += yamlCompatibilityEnabled_ ? ": " : ":";
4520 writeValue(value[name]);
4521 }
4522 document_ += '}';
4523 } break;
4524 }
4525}
4526
4527// Class StyledWriter
4528// //////////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 15

valueToStringFunction · 0.85
valueToQuotedStringNFunction · 0.85
indentFunction · 0.85
valueToQuotedStringFunction · 0.85
asLargestIntMethod · 0.80
asLargestUIntMethod · 0.80
asBoolMethod · 0.80
getMemberNamesMethod · 0.80
typeMethod · 0.45
asDoubleMethod · 0.45
getStringMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected