[Bf-blender-cvs] [e2fdc6226a9] master: Cleanup: rename ValueType.Object to ValueType.Dictionary.

Jeroen Bakker noreply at git.blender.org
Mon Jan 3 10:25:41 CET 2022


Commit: e2fdc6226a9f58afe1024b832989ede2c211124e
Author: Jeroen Bakker
Date:   Mon Jan 3 10:23:09 2022 +0100
Branches: master
https://developer.blender.org/rBe2fdc6226a9f58afe1024b832989ede2c211124e

Cleanup: rename ValueType.Object to ValueType.Dictionary.

===================================================================

M	source/blender/blenlib/BLI_serialize.hh
M	source/blender/blenlib/intern/serialize.cc

===================================================================

diff --git a/source/blender/blenlib/BLI_serialize.hh b/source/blender/blenlib/BLI_serialize.hh
index b1002b07fd3..11ac1c6605b 100644
--- a/source/blender/blenlib/BLI_serialize.hh
+++ b/source/blender/blenlib/BLI_serialize.hh
@@ -92,7 +92,7 @@ enum class eValueType {
   Null,
   Boolean,
   Double,
-  Object,
+  Dictionary,
 };
 
 class Value;
@@ -122,8 +122,8 @@ using ArrayValue = ContainerValue<Vector<std::shared_ptr<Value>>, eValueType::Ar
  * - `NullValue`: represents nothing (null pointer or optional).
  * - `BooleanValue`: contains a boolean (true/false).
  * - `DoubleValue`: contains a double precision floating point number.
- * - `DictionaryValue`: represents an object (key value pairs where keys are strings and values can be
- *   of different types.
+ * - `DictionaryValue`: represents an object (key value pairs where keys are strings and values can
+ * be of different types.
  *
  */
 class Value {
@@ -275,7 +275,7 @@ using ObjectElementType = std::pair<std::string, std::shared_ptr<Value>>;
  * Object is a key-value container where the key must be a std::string.
  * Internally it is stored in a blender::Vector to ensure the order of keys.
  */
-class DictionaryValue : public ContainerValue<Vector<ObjectElementType>, eValueType::Object> {
+class DictionaryValue : public ContainerValue<Vector<ObjectElementType>, eValueType::Dictionary> {
  public:
   using LookupValue = std::shared_ptr<Value>;
   using Lookup = Map<std::string, LookupValue>;
diff --git a/source/blender/blenlib/intern/serialize.cc b/source/blender/blenlib/intern/serialize.cc
index a17d7a189f6..03d08bd20c6 100644
--- a/source/blender/blenlib/intern/serialize.cc
+++ b/source/blender/blenlib/intern/serialize.cc
@@ -46,7 +46,7 @@ const ArrayValue *Value::as_array_value() const
 
 const DictionaryValue *Value::as_object_value() const
 {
-  if (type_ != eValueType::Object) {
+  if (type_ != eValueType::Dictionary) {
     return nullptr;
   }
   return static_cast<const DictionaryValue *>(this);
@@ -98,7 +98,7 @@ static void convert_to_json(nlohmann::ordered_json &j, const Value &value)
       break;
     }
 
-    case eValueType::Object: {
+    case eValueType::Dictionary: {
       const DictionaryValue &object = *value.as_object_value();
       convert_to_json(j, object);
       break;
@@ -133,7 +133,8 @@ static std::unique_ptr<ArrayValue> convert_from_json_to_array(const nlohmann::or
   return array;
 }
 
-static std::unique_ptr<DictionaryValue> convert_from_json_to_object(const nlohmann::ordered_json &j)
+static std::unique_ptr<DictionaryValue> convert_from_json_to_object(
+    const nlohmann::ordered_json &j)
 {
   std::unique_ptr<DictionaryValue> object = std::make_unique<DictionaryValue>();
   DictionaryValue::Items &elements = object->elements();



More information about the Bf-blender-cvs mailing list