MCPcopy Create free account
hub / github.com/Samsung/ONE / writeValue

Method writeValue

runtime/3rdparty/jsoncpp/jsoncpp.cpp:4813–4873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4811}
4812
4813void FastWriter::writeValue(const Value &value)
4814{
4815 switch (value.type())
4816 {
4817 case nullValue:
4818 if (!dropNullPlaceholders_)
4819 document_ += "null";
4820 break;
4821 case intValue:
4822 document_ += valueToString(value.asLargestInt());
4823 break;
4824 case uintValue:
4825 document_ += valueToString(value.asLargestUInt());
4826 break;
4827 case realValue:
4828 document_ += valueToString(value.asDouble());
4829 break;
4830 case stringValue:
4831 {
4832 // Is NULL possible for value.string_? No.
4833 char const *str;
4834 char const *end;
4835 bool ok = value.getString(&str, &end);
4836 if (ok)
4837 document_ += valueToQuotedStringN(str, static_cast<size_t>(end - str));
4838 break;
4839 }
4840 case booleanValue:
4841 document_ += valueToString(value.asBool());
4842 break;
4843 case arrayValue:
4844 {
4845 document_ += '[';
4846 ArrayIndex size = value.size();
4847 for (ArrayIndex index = 0; index < size; ++index)
4848 {
4849 if (index > 0)
4850 document_ += ',';
4851 writeValue(value[index]);
4852 }
4853 document_ += ']';
4854 }
4855 break;
4856 case objectValue:
4857 {
4858 Value::Members members(value.getMemberNames());
4859 document_ += '{';
4860 for (auto it = members.begin(); it != members.end(); ++it)
4861 {
4862 const String &name = *it;
4863 if (it != members.begin())
4864 document_ += ',';
4865 document_ += valueToQuotedStringN(name.data(), name.length());
4866 document_ += yamlCompatibilityEnabled_ ? ": " : ":";
4867 writeValue(value[name]);
4868 }
4869 document_ += '}';
4870 }

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

Tested by

no test coverage detected