MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / writeValue

Method writeValue

src/share/jsoncpp/jsoncpp.cpp:4423–4475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4421}
4422
4423void FastWriter::writeValue(const Value& value) {
4424 switch (value.type()) {
4425 case nullValue:
4426 if (!dropNullPlaceholders_)
4427 document_ += "null";
4428 break;
4429 case intValue:
4430 document_ += valueToString(value.asLargestInt());
4431 break;
4432 case uintValue:
4433 document_ += valueToString(value.asLargestUInt());
4434 break;
4435 case realValue:
4436 document_ += valueToString(value.asDouble());
4437 break;
4438 case stringValue:
4439 {
4440 // Is NULL possible for value.string_? No.
4441 char const* str;
4442 char const* end;
4443 bool ok = value.getString(&str, &end);
4444 if (ok) document_ += valueToQuotedStringN(str, static_cast<unsigned>(end-str));
4445 break;
4446 }
4447 case booleanValue:
4448 document_ += valueToString(value.asBool());
4449 break;
4450 case arrayValue: {
4451 document_ += '[';
4452 ArrayIndex size = value.size();
4453 for (ArrayIndex index = 0; index < size; ++index) {
4454 if (index > 0)
4455 document_ += ',';
4456 writeValue(value[index]);
4457 }
4458 document_ += ']';
4459 } break;
4460 case objectValue: {
4461 Value::Members members(value.getMemberNames());
4462 document_ += '{';
4463 for (Value::Members::iterator it = members.begin(); it != members.end();
4464 ++it) {
4465 const JSONCPP_STRING& name = *it;
4466 if (it != members.begin())
4467 document_ += ',';
4468 document_ += valueToQuotedStringN(name.data(), static_cast<unsigned>(name.length()));
4469 document_ += yamlCompatiblityEnabled_ ? ": " : ":";
4470 writeValue(value[name]);
4471 }
4472 document_ += '}';
4473 } break;
4474 }
4475}
4476
4477// Class StyledWriter
4478// //////////////////////////////////////////////////////////////////

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
asDoubleMethod · 0.80
asBoolMethod · 0.80
sizeMethod · 0.80
getMemberNamesMethod · 0.80
beginMethod · 0.80
endMethod · 0.80

Tested by

no test coverage detected