[Bf-blender-cvs] [9bb7d6ed68e] master: BLI: put C++ data structures in "blender" namespace instead of "BLI"

Jacques Lucke noreply at git.blender.org
Tue Jun 9 10:27:34 CEST 2020


Commit: 9bb7d6ed68ef1aa0e6acc3e70901cb6b79c682d2
Author: Jacques Lucke
Date:   Tue Jun 9 10:27:24 2020 +0200
Branches: master
https://developer.blender.org/rB9bb7d6ed68ef1aa0e6acc3e70901cb6b79c682d2

BLI: put C++ data structures in "blender" namespace instead of "BLI"

We plan to use the "blender" namespace in other modules as well.

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

M	source/blender/blenkernel/intern/simulation.cc
M	source/blender/blenlib/BLI_allocator.hh
M	source/blender/blenlib/BLI_array.hh
M	source/blender/blenlib/BLI_array_ref.hh
M	source/blender/blenlib/BLI_color.hh
M	source/blender/blenlib/BLI_dot_export.hh
M	source/blender/blenlib/BLI_dot_export_attribute_enums.hh
M	source/blender/blenlib/BLI_float2.hh
M	source/blender/blenlib/BLI_float3.hh
M	source/blender/blenlib/BLI_float4x4.hh
M	source/blender/blenlib/BLI_hash.hh
M	source/blender/blenlib/BLI_hash_tables.hh
M	source/blender/blenlib/BLI_index_mask.hh
M	source/blender/blenlib/BLI_index_range.hh
M	source/blender/blenlib/BLI_linear_allocator.hh
M	source/blender/blenlib/BLI_listbase_wrapper.hh
M	source/blender/blenlib/BLI_map.hh
M	source/blender/blenlib/BLI_map_slots.hh
M	source/blender/blenlib/BLI_memory_utils.hh
M	source/blender/blenlib/BLI_optional.hh
M	source/blender/blenlib/BLI_probing_strategies.hh
M	source/blender/blenlib/BLI_set.hh
M	source/blender/blenlib/BLI_set_slots.hh
M	source/blender/blenlib/BLI_stack.hh
M	source/blender/blenlib/BLI_string_ref.hh
M	source/blender/blenlib/BLI_timeit.hh
M	source/blender/blenlib/BLI_utility_mixins.hh
M	source/blender/blenlib/BLI_vector.hh
M	source/blender/blenlib/BLI_vector_set.hh
M	source/blender/blenlib/BLI_vector_set_slots.hh
M	source/blender/blenlib/intern/BLI_index_range.cc
M	source/blender/blenlib/intern/dot_export.cc
M	source/blender/blenlib/intern/timeit.cc
M	source/blender/depsgraph/intern/builder/deg_builder_rna.cc
M	source/blender/depsgraph/intern/depsgraph_type.h
M	source/blender/depsgraph/intern/node/deg_node_component.h
M	source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h
M	source/blender/functions/FN_cpp_type.hh
M	source/blender/functions/intern/cpp_types.cc
M	source/blender/modifiers/intern/MOD_mask.cc
M	source/blender/modifiers/intern/MOD_simulation.cc
M	tests/gtests/blenlib/BLI_array_ref_test.cc
M	tests/gtests/blenlib/BLI_array_test.cc
M	tests/gtests/blenlib/BLI_index_mask_test.cc
M	tests/gtests/blenlib/BLI_index_range_test.cc
M	tests/gtests/blenlib/BLI_linear_allocator_test.cc
M	tests/gtests/blenlib/BLI_map_test.cc
M	tests/gtests/blenlib/BLI_optional_test.cc
M	tests/gtests/blenlib/BLI_set_test.cc
M	tests/gtests/blenlib/BLI_stack_cxx_test.cc
M	tests/gtests/blenlib/BLI_string_ref_test.cc
M	tests/gtests/blenlib/BLI_vector_set_test.cc
M	tests/gtests/blenlib/BLI_vector_test.cc

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

diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc
index 20386869ca9..8f08665ab8a 100644
--- a/source/blender/blenkernel/intern/simulation.cc
+++ b/source/blender/blenkernel/intern/simulation.cc
@@ -54,9 +54,9 @@
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_query.h"
 
-using BLI::ArrayRef;
-using BLI::float3;
-using BLI::MutableArrayRef;
+using blender::ArrayRef;
+using blender::float3;
+using blender::MutableArrayRef;
 
 static void simulation_init_data(ID *id)
 {
diff --git a/source/blender/blenlib/BLI_allocator.hh b/source/blender/blenlib/BLI_allocator.hh
index cf81b024277..d57703f71bc 100644
--- a/source/blender/blenlib/BLI_allocator.hh
+++ b/source/blender/blenlib/BLI_allocator.hh
@@ -19,9 +19,9 @@
 /** \file
  * \ingroup bli
  *
- * An `Allocator` can allocate and deallocate memory. It is used by containers such as BLI::Vector.
- * The allocators defined in this file do not work with standard library containers such as
- * std::vector.
+ * An `Allocator` can allocate and deallocate memory. It is used by containers such as
+ * blender::Vector. The allocators defined in this file do not work with standard library
+ * containers such as std::vector.
  *
  * Every allocator has to implement two methods:
  *   void *allocate(size_t size, size_t alignment, const char *name);
@@ -46,7 +46,7 @@
 #include "BLI_math_base.h"
 #include "BLI_utildefines.h"
 
-namespace BLI {
+namespace blender {
 
 /**
  * Use Blender's guarded allocator (aka MEM_*). This should always be used except there is a
@@ -99,6 +99,6 @@ class RawAllocator {
   }
 };
 
-}  // namespace BLI
+}  // namespace blender
 
 #endif /* __BLI_ALLOCATOR_HH__ */
diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh
index 09eeb321abf..874cd6b215a 100644
--- a/source/blender/blenlib/BLI_array.hh
+++ b/source/blender/blenlib/BLI_array.hh
@@ -19,23 +19,23 @@
 /** \file
  * \ingroup bli
  *
- * A `BLI::Array<T>` is a container for a fixed size array the size of which is NOT known at
+ * A `blender::Array<T>` is a container for a fixed size array the size of which is NOT known at
  * compile time.
  *
  * If the size is known at compile time, `std::array<T, N>` should be used instead.
  *
- * BLI::Array should usually be used instead of BLI::Vector whenever the number of elements is
- * known at construction time. Note however, that BLI::Array will default construct all elements
- * when initialized with the size-constructor. For trivial types, this does nothing. In all other
- * cases, this adds overhead. If this becomes a problem, a different constructor which does not do
- * default construction can be added.
+ * blender::Array should usually be used instead of blender::Vector whenever the number of elements
+ * is known at construction time. Note however, that blender::Array will default construct all
+ * elements when initialized with the size-constructor. For trivial types, this does nothing. In
+ * all other cases, this adds overhead. If this becomes a problem, a different constructor which
+ * does not do default construction can be added.
  *
  * A main benefit of using Array over Vector is that it expresses the intent of the developer
  * better. It indicates that the size of the data structure is not expected to change. Furthermore,
  * you can be more certain that an array does not overallocate.
  *
- * BLI::Array supports small object optimization to improve performance when the size turns out to
- * be small at run-time.
+ * blender::Array supports small object optimization to improve performance when the size turns out
+ * to be small at run-time.
  */
 
 #include "BLI_allocator.hh"
@@ -44,7 +44,7 @@
 #include "BLI_memory_utils.hh"
 #include "BLI_utildefines.h"
 
-namespace BLI {
+namespace blender {
 
 template<
     /**
@@ -341,6 +341,6 @@ class Array {
   }
 };
 
-}  // namespace BLI
+}  // namespace blender
 
 #endif /* __BLI_ARRAY_HH__ */
diff --git a/source/blender/blenlib/BLI_array_ref.hh b/source/blender/blenlib/BLI_array_ref.hh
index 34745c0af83..2a4d0b6e0df 100644
--- a/source/blender/blenlib/BLI_array_ref.hh
+++ b/source/blender/blenlib/BLI_array_ref.hh
@@ -20,26 +20,26 @@
 /** \file
  * \ingroup bli
  *
- * A `BLI::ArrayRef<T>` references an array that is owned by someone else. It is just a pointer and
- * a size. Since the memory is not owned, ArrayRef should not be used to transfer ownership. The
- * array cannot be modified through the ArrayRef. However, if T is a non-const pointer, the
- * pointed-to elements can be modified.
+ * An `blender::ArrayRef<T>` references an array that is owned by someone else. It is just a
+ * pointer and a size. Since the memory is not owned, ArrayRef should not be used to transfer
+ * ownership. The array cannot be modified through the ArrayRef. However, if T is a non-const
+ * pointer, the pointed-to elements can be modified.
  *
- * There is also `BLI::MutableArrayRef<T>`. It is mostly the same as ArrayRef, but allows the array
- * to be modified.
+ * There is also `blender::MutableArrayRef<T>`. It is mostly the same as ArrayRef, but allows the
+ * array to be modified.
  *
  * An (Mutable)ArrayRef can refer to data owned by many different data structures including
- * BLI::Vector, BLI::Array, BLI::VectorSet, std::vector, std::array, std::string,
+ * blender::Vector, blender::Array, blender::VectorSet, std::vector, std::array, std::string,
  * std::initializer_list and c-style array.
  *
- * `BLI::ArrayRef<T>` should be your default choice when you have to pass a read-only array into a
- * function. It is better than passing a `const Vector &`, because then the function only works for
- * vectors and not for e.g. arrays. Using ArrayRef as function parameter makes it usable in more
- * contexts, better expresses the intent and does not sacrifice performance. It is also better than
- * passing a raw pointer and size separately, because it is more convenient and safe.
+ * `blender::ArrayRef<T>` should be your default choice when you have to pass a read-only array
+ * into a function. It is better than passing a `const Vector &`, because then the function only
+ * works for vectors and not for e.g. arrays. Using ArrayRef as function parameter makes it usable
+ * in more contexts, better expresses the intent and does not sacrifice performance. It is also
+ * better than passing a raw pointer and size separately, because it is more convenient and safe.
  *
- * `BLI::MutableArrayRef<T>` can be used when a function is supposed to return an array, the size
- * of which is known before the function is called. One advantage of this approach is that the
+ * `blender::MutableArrayRef<T>` can be used when a function is supposed to return an array, the
+ * size of which is known before the function is called. One advantage of this approach is that the
  * caller is responsible for allocation and deallocation. Furthermore, the function can focus on
  * its task, without having to worry about memory allocation. Alternatively, a function could
  * return an Array or Vector.
@@ -64,7 +64,7 @@
 #include "BLI_memory_utils.hh"
 #include "BLI_utildefines.h"
 
-namespace BLI {
+namespace blender {
 
 /**
  * References an array of type T that is owned by someone else. The data in the array cannot be
@@ -625,6 +625,6 @@ void assert_same_size(const T1 &v1, const T2 &v2, const T3 &v3)
 #endif
 }
 
-} /* namespace BLI */
+} /* namespace blender */
 
 #endif /* __BLI_ARRAY_REF_HH__ */
diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh
index ff28ae2c076..432459c9998 100644
--- a/source/blender/blenlib/BLI_color.hh
+++ b/source/blender/blenlib/BLI_color.hh
@@ -21,7 +21,7 @@
 
 #include "BLI_math_color.h"
 
-namespace BLI {
+namespace blender {
 
 struct Color4f {
   float r, g, b, a;
@@ -87,6 +87,6 @@ struct Color4b {
   }
 };
 
-}  // namespace BLI
+}  // namespace blender
 
 #endif /* __BLI_COLOR_HH__ */
diff --git a/source/blender/blenlib/BLI_dot_export.hh b/source/blender/blenlib/BLI_dot_export.hh
index 8da0ed6df14..60353d7913f 100644
--- a/source/blender/blenlib/BLI_dot_export.hh
+++ b/source/blender/blenlib/BLI_dot_export.hh
@@ -34,7 +34,7 @@
 
 #include <sstream>
 
-namespace BLI {
+namespace blender {
 namespace DotExport {
 
 class Graph;
@@ -208,7 +208,7 @@ class NodePort {
   void to_dot_string(std::stringstream &ss) const;
 };
 
-class Edge : BLI::NonCopyable, BLI::NonMovable {
+class Edge : blender::NonCopyable, blender::NonMovable {
  protected:
   AttributeList m_attributes;
   NodePort m_a;
@@ -284,6 +284,6 @@ class NodeWithSocketsRef {
 };
 
 }  // namespace DotExport
-}  // namespace BLI
+}  // namespace blender
 
 #endif /* __BLI_DOT_EXPORT_HH__ */
diff --git a/source/blender/blenlib/BLI_dot_export_attribute_enums.hh b/source/blender/blenlib/BLI_dot_export_attribute_enums.hh
index 8e61f46dc12..8fe1cda05f3 100644
--- a/source/blender/blenlib/BLI_dot_export_attribute_enums.hh
+++ b/source/blender/blenlib/BLI_dot_export_attribute_enums.hh
@@ -19,7 +19,7 @@
 
 #include "BLI_string_ref.hh"
 
-namespace BLI {
+namespace blender {
 namespace DotExport {
 
 enum class Attr_rankdir {
@@ -120,6 +120,6 @@ inline StringRef dirType_to_string(Attr_dirType value)
 }
 
 }  // namespace DotExport
-}  // namespace BLI
+}  // namespace blender
 
 #endif /* __BLI_DOT_EXPORT_ATTRIBUTE_ENUMS_HH__ */
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh
index da12dd7d206..94da5d18ad2 100644
--- a/source/blender/blenlib/BLI_float2.hh
+++ b/source/blender/blenlib/BLI_float2.hh
@@ -19,7 +19,7 @@
 
 #include "BLI_float3.hh"
 
-namespace BLI {
+namespace blender {
 
 struct float2 {
   float x, y;
@@ -81,6 +81,6 @@ struct float2 {
   }
 };
 
-}  // namespace BLI
+}  // namespace blender
 
 #endif /* __BLI_FLOAT2_HH__ */
diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh
index 9678fa4b2d3..7ef4f1b4973 100644
--- a/source/blender/blenlib/BLI_float3.hh
+++ b/source/blender/blenlib/BLI_float3.hh
@@ -21,7 +21,7 @@
 
 #include "BLI_math_vector.h"
 
-namespace BLI {
+namespace blender {
 
 struct float3 {
   float x, y, z;
@@ -213,6 +213,6 @@ struct float3 {
   }
 };
 
-}  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list