Added shallow copy constructors for Json_Array and Json_Object && Added a float type constructor for Json_Value && Fixed the incorrect indentation issue when pretty-printing an empty Json_Array.

This commit is contained in:
2026-04-21 20:54:07 +08:00
parent e80d14d347
commit ce6f9646c4
2 changed files with 20 additions and 1 deletions
+15 -1
View File
@@ -786,7 +786,7 @@ std::string Json_Export(const char *path_to_file, Json_Value value, bool enable_
fprintf(pFile, "\r\n");
}
// 尾部缩进
if (enable_pretty_print && (!value.isNull()))
if (enable_pretty_print && (!arry.isNull()))
for (size_t count = 0; count < depth; count++)
fprintf(pFile, " ");
@@ -1041,6 +1041,13 @@ bool Json_Pair::isNull() const
// =================================================================================================
// 浅拷贝构造
Json_Arry::Json_Arry(const Json_Arry &temp)
{
// 执行深拷贝
*this = temp;
}
// 深拷贝
Json_Arry &Json_Arry::operator=(const Json_Arry &another)
{
@@ -1075,6 +1082,13 @@ bool Json_Arry::isNull(void) const
// =================================================================================================
// 浅拷贝构造
Json_Object::Json_Object(const Json_Object &temp)
{
// 执行深拷贝
*this = temp;
}
// 深拷贝
Json_Object &Json_Object::operator=(const Json_Object &another)
{