MCPcopy Create free account
hub / github.com/SOUI2/soui / parseAndSaveValueTree

Function parseAndSaveValueTree

third-part/jsoncpp/src/jsontestrunner/main.cpp:143–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static int parseAndSaveValueTree(const JSONCPP_STRING& input,
144 const JSONCPP_STRING& actual,
145 const JSONCPP_STRING& kind,
146 const Json::Features& features,
147 bool parseOnly,
148 Json::Value* root)
149{
150 Json::Reader reader(features);
151 bool parsingSuccessful = reader.parse(input.data(), input.data() + input.size(), *root);
152 if (!parsingSuccessful) {
153 printf("Failed to parse %s file: \n%s\n",
154 kind.c_str(),
155 reader.getFormattedErrorMessages().c_str());
156 return 1;
157 }
158 if (!parseOnly) {
159 FILE* factual = fopen(actual.c_str(), "wt");
160 if (!factual) {
161 printf("Failed to create %s actual file.\n", kind.c_str());
162 return 2;
163 }
164 printValueTree(factual, *root);
165 fclose(factual);
166 }
167 return 0;
168}
169// static JSONCPP_STRING useFastWriter(Json::Value const& root) {
170// Json::FastWriter writer;
171// writer.enableYAMLCompatibility();

Callers 1

runTestFunction · 0.70

Calls 6

printValueTreeFunction · 0.85
parseMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected