| 85 | }; |
| 86 | |
| 87 | static void string_append_value(const BUTIL_RAPIDJSON_NAMESPACE::Value& value, |
| 88 | std::string* output) { |
| 89 | if (value.IsNull()) { |
| 90 | output->append("null"); |
| 91 | } else if (value.IsBool()) { |
| 92 | output->append(value.GetBool() ? "true" : "false"); |
| 93 | } else if (value.IsInt()) { |
| 94 | butil::string_appendf(output, "%d", value.GetInt()); |
| 95 | } else if (value.IsUint()) { |
| 96 | butil::string_appendf(output, "%u", value.GetUint()); |
| 97 | } else if (value.IsInt64()) { |
| 98 | butil::string_appendf(output, "%" PRId64, value.GetInt64()); |
| 99 | } else if (value.IsUint64()) { |
| 100 | butil::string_appendf(output, "%" PRIu64, value.GetUint64()); |
| 101 | } else if (value.IsDouble()) { |
| 102 | butil::string_appendf(output, "%f", value.GetDouble()); |
| 103 | } else if (value.IsString()) { |
| 104 | output->push_back('"'); |
| 105 | output->append(value.GetString(), value.GetStringLength()); |
| 106 | output->push_back('"'); |
| 107 | } else if (value.IsArray()) { |
| 108 | output->append("array"); |
| 109 | } else if (value.IsObject()) { |
| 110 | output->append("object"); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | //It will be called when type mismatch occurs, fg: convert string to uint, |
| 115 | //and will also be called when invalid value appears, fg: invalid enum name, |
no test coverage detected