MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / writeValue

Method writeValue

json/jsoncpp.cpp:4547–4600  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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
c_strMethod · 0.80
typeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected