MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / PrintObject

Function PrintObject

Applications/JSONDump/main.cpp:33–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void PrintObject(JSONValue& json){
34 std::cout << "Object{ ";
35 for(auto& v : *json.object){
36 std::cout << "key: \"" << v.first << "\", value: ";
37 if(v.second.IsObject()){
38 PrintObject(v.second);
39 } else if(v.second.IsArray()){
40 PrintArray(v.second);
41 } else if(v.second.isFloatingPoint){
42 std::cout << v.second.AsFloat();
43 } else if(v.second.IsString()){
44 std::cout << v.second.AsString();
45 } else if(v.second.IsNumber()){
46 std::cout << v.second.AsSignedNumber();
47 } else if(v.second.IsBool()){
48 std::cout << (v.second.AsBool() ? "true" : "false");
49 } else {
50 std::cout << "null";
51 }
52 std::cout << ",\n";
53 }
54 std::cout << " }\n";
55}
56
57std::stringstream ss;
58std::ifstream file;

Callers 2

PrintArrayFunction · 0.85
mainFunction · 0.85

Calls 10

PrintArrayFunction · 0.85
IsObjectMethod · 0.80
IsArrayMethod · 0.80
AsFloatMethod · 0.80
IsStringMethod · 0.80
AsStringMethod · 0.80
IsNumberMethod · 0.80
AsSignedNumberMethod · 0.80
IsBoolMethod · 0.80
AsBoolMethod · 0.80

Tested by

no test coverage detected