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

Function main

Applications/JSONDump/main.cpp:60–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58std::ifstream file;
59std::string str;
60int main(int argc, char** argv){
61 if(argc < 2){
62 std::cout << "Usage: " << argv[0] << " <file>\n";
63 return 1;
64 }
65
66 file.open(argv[1]);
67
68 if(!file.is_open()){
69 std::cout << "Error opening file " << argv[1] << "!\n";
70 return 2;
71 }
72
73 ss << file.rdbuf();
74
75 str = ss.str();
76 std::string_view sv = std::string_view(str);
77 Lemon::JSONParser p = Lemon::JSONParser(sv);
78
79 auto json = p.Parse();
80 if(!json.IsObject()){
81 std::cout << "Error parsing JSON file!\n";
82 return 3;
83 }
84
85 PrintObject(json);
86
87 return 0;
88}

Callers

nothing calls this directly

Calls 4

JSONParserClass · 0.85
PrintObjectFunction · 0.85
IsObjectMethod · 0.80
ParseMethod · 0.45

Tested by

no test coverage detected