MCPcopy Create free account
hub / github.com/PlayFab/gsdk / writeValue

Method writeValue

cpp/cppsdk/jsoncpp.cpp:4545–4598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4543}
4544
4545void FastWriter::writeValue(const Value& value) {
4546 switch (value.type()) {
4547 case nullValue:
4548 if (!dropNullPlaceholders_)
4549 document_ += "null";
4550 break;
4551 case intValue:
4552 document_ += valueToString(value.asLargestInt());
4553 break;
4554 case uintValue:
4555 document_ += valueToString(value.asLargestUInt());
4556 break;
4557 case realValue:
4558 document_ += valueToString(value.asDouble());
4559 break;
4560 case stringValue: {
4561 // Is NULL possible for value.string_? No.
4562 char const* str;
4563 char const* end;
4564 bool ok = value.getString(&str, &end);
4565 if (ok)
4566 document_ += valueToQuotedStringN(str, static_cast<unsigned>(end - str));
4567 break;
4568 }
4569 case booleanValue:
4570 document_ += valueToString(value.asBool());
4571 break;
4572 case arrayValue: {
4573 document_ += '[';
4574 ArrayIndex size = value.size();
4575 for (ArrayIndex index = 0; index < size; ++index) {
4576 if (index > 0)
4577 document_ += ',';
4578 writeValue(value[index]);
4579 }
4580 document_ += ']';
4581 } break;
4582 case objectValue: {
4583 Value::Members members(value.getMemberNames());
4584 document_ += '{';
4585 for (Value::Members::iterator it = members.begin(); it != members.end();
4586 ++it) {
4587 const JSONCPP_STRING& name = *it;
4588 if (it != members.begin())
4589 document_ += ',';
4590 document_ += valueToQuotedStringN(name.data(),
4591 static_cast<unsigned>(name.length()));
4592 document_ += yamlCompatibilityEnabled_ ? ": " : ":";
4593 writeValue(value[name]);
4594 }
4595 document_ += '}';
4596 } break;
4597 }
4598}
4599
4600// Class StyledWriter
4601// //////////////////////////////////////////////////////////////////

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

Tested by

no test coverage detected