Lines Matching refs:Json
24 Json::String path;
25 Json::Features features;
27 using writeFuncType = Json::String (*)(Json::Value const&);
31 static Json::String normalizeFloatingPointStr(double value) { in normalizeFloatingPointStr()
35 Json::String s(buffer); in normalizeFloatingPointStr()
36 Json::String::size_type index = s.find_last_of("eE"); in normalizeFloatingPointStr()
37 if (index != Json::String::npos) { in normalizeFloatingPointStr()
38 Json::String::size_type hasSign = in normalizeFloatingPointStr()
40 Json::String::size_type exponentStartIndex = index + 1 + hasSign; in normalizeFloatingPointStr()
41 Json::String normalized = s.substr(0, exponentStartIndex); in normalizeFloatingPointStr()
42 Json::String::size_type indexDigit = in normalizeFloatingPointStr()
44 Json::String exponent = "0"; in normalizeFloatingPointStr()
45 if (indexDigit != Json::String::npos) // There is an exponent different in normalizeFloatingPointStr()
55 static Json::String readInputTestFile(const char* path) { in readInputTestFile()
65 Json::String text; in readInputTestFile()
73 static void printValueTree(FILE* fout, Json::Value& value, in printValueTree()
74 const Json::String& path = ".") { in printValueTree()
75 if (value.hasComment(Json::commentBefore)) { in printValueTree()
76 fprintf(fout, "%s\n", value.getComment(Json::commentBefore).c_str()); in printValueTree()
79 case Json::nullValue: in printValueTree()
82 case Json::intValue: in printValueTree()
84 Json::valueToString(value.asLargestInt()).c_str()); in printValueTree()
86 case Json::uintValue: in printValueTree()
88 Json::valueToString(value.asLargestUInt()).c_str()); in printValueTree()
90 case Json::realValue: in printValueTree()
94 case Json::stringValue: in printValueTree()
97 case Json::booleanValue: in printValueTree()
100 case Json::arrayValue: { in printValueTree()
102 Json::ArrayIndex size = value.size(); in printValueTree()
103 for (Json::ArrayIndex index = 0; index < size; ++index) { in printValueTree()
109 case Json::objectValue: { in printValueTree()
111 Json::Value::Members members(value.getMemberNames()); in printValueTree()
113 Json::String suffix = *(path.end() - 1) == '.' ? "" : "."; in printValueTree()
122 if (value.hasComment(Json::commentAfter)) { in printValueTree()
123 fprintf(fout, "%s\n", value.getComment(Json::commentAfter).c_str()); in printValueTree()
127 static int parseAndSaveValueTree(const Json::String& input, in parseAndSaveValueTree()
128 const Json::String& actual, in parseAndSaveValueTree()
129 const Json::String& kind, in parseAndSaveValueTree()
130 const Json::Features& features, bool parseOnly, in parseAndSaveValueTree()
131 Json::Value* root, bool use_legacy) { in parseAndSaveValueTree()
133 Json::CharReaderBuilder builder; in parseAndSaveValueTree()
141 std::unique_ptr<Json::CharReader> reader(builder.newCharReader()); in parseAndSaveValueTree()
142 Json::String errors; in parseAndSaveValueTree()
155 Json::Reader reader(features); in parseAndSaveValueTree()
182 static Json::String useStyledWriter(Json::Value const& root) { in useStyledWriter()
183 Json::StyledWriter writer; in useStyledWriter()
186 static Json::String useStyledStreamWriter(Json::Value const& root) { in useStyledStreamWriter()
187 Json::StyledStreamWriter writer; in useStyledStreamWriter()
188 Json::OStringStream sout; in useStyledStreamWriter()
192 static Json::String useBuiltStyledStreamWriter(Json::Value const& root) { in useBuiltStyledStreamWriter()
193 Json::StreamWriterBuilder builder; in useBuiltStyledStreamWriter()
194 return Json::writeString(builder, root); in useBuiltStyledStreamWriter()
196 static int rewriteValueTree(const Json::String& rewritePath, in rewriteValueTree()
197 const Json::Value& root, in rewriteValueTree()
199 Json::String* rewrite) { in rewriteValueTree()
211 static Json::String removeSuffix(const Json::String& path, in removeSuffix()
212 const Json::String& extension) { in removeSuffix()
214 return Json::String(""); in removeSuffix()
215 Json::String suffix = path.substr(path.length() - extension.length()); in removeSuffix()
217 return Json::String(""); in removeSuffix()
243 if (Json::String(argv[index]) == "--json-checker") { in parseCommandLine()
244 opts->features = Json::Features::strictMode(); in parseCommandLine()
248 if (Json::String(argv[index]) == "--json-config") { in parseCommandLine()
252 if (Json::String(argv[index]) == "--json-writer") { in parseCommandLine()
254 Json::String const writerName(argv[index++]); in parseCommandLine()
276 Json::String input = readInputTestFile(opts.path.c_str()); in runTest()
282 Json::String basePath = removeSuffix(opts.path, ".json"); in runTest()
289 Json::String const actualPath = basePath + ".actual"; in runTest()
290 Json::String const rewritePath = basePath + ".rewrite"; in runTest()
291 Json::String const rewriteActualPath = basePath + ".actual-rewrite"; in runTest()
293 Json::Value root; in runTest()
300 Json::String rewrite; in runTest()
306 Json::Value rewriteRoot; in runTest()