diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh index d580ce54f1d..236baf303e0 100644 --- a/source/blender/functions/FN_cpp_type.hh +++ b/source/blender/functions/FN_cpp_type.hh @@ -70,6 +70,7 @@ #include "BLI_math_base.h" #include "BLI_string_ref.hh" +namespace blender { namespace FN { using blender::IndexMask; @@ -719,13 +720,14 @@ static std::unique_ptr create_cpp_type(StringRef name, const T &d } } // namespace FN +} // namespace blender #define MAKE_CPP_TYPE(IDENTIFIER, TYPE_NAME) \ static TYPE_NAME default_value_##IDENTIFIER; \ - static std::unique_ptr CPPTYPE_##IDENTIFIER##_owner = \ - FN::create_cpp_type(STRINGIFY(IDENTIFIER), default_value_##IDENTIFIER); \ - const FN::CPPType &CPPType_##IDENTIFIER = *CPPTYPE_##IDENTIFIER##_owner; \ - template<> const FN::CPPType &FN::CPPType::get() \ + static std::unique_ptr CPPTYPE_##IDENTIFIER##_owner = \ + blender::FN::create_cpp_type(STRINGIFY(IDENTIFIER), default_value_##IDENTIFIER); \ + const blender::FN::CPPType &CPPType_##IDENTIFIER = *CPPTYPE_##IDENTIFIER##_owner; \ + template<> const blender::FN::CPPType &blender::FN::CPPType::get() \ { \ return CPPType_##IDENTIFIER; \ } diff --git a/source/blender/functions/FN_cpp_types.hh b/source/blender/functions/FN_cpp_types.hh index eceb43beb9d..6ee8788cd52 100644 --- a/source/blender/functions/FN_cpp_types.hh +++ b/source/blender/functions/FN_cpp_types.hh @@ -26,6 +26,7 @@ #include "FN_cpp_type.hh" +namespace blender { namespace FN { extern const CPPType &CPPType_bool; @@ -44,5 +45,6 @@ extern const CPPType &CPPType_Color4b; extern const CPPType &CPPType_string; } // namespace FN +} // namespace blender #endif /* __FN_CPP_TYPES_HH__ */ diff --git a/source/blender/functions/intern/cpp_types.cc b/source/blender/functions/intern/cpp_types.cc index 6e548d65192..6339250caa5 100644 --- a/source/blender/functions/intern/cpp_types.cc +++ b/source/blender/functions/intern/cpp_types.cc @@ -21,6 +21,7 @@ #include "BLI_float3.hh" #include "BLI_float4x4.hh" +namespace blender { namespace FN { MAKE_CPP_TYPE(bool, bool) @@ -39,3 +40,4 @@ MAKE_CPP_TYPE(Color4b, blender::Color4b) MAKE_CPP_TYPE(string, std::string) } // namespace FN +} // namespace blender diff --git a/tests/gtests/functions/FN_cpp_type_test.cc b/tests/gtests/functions/FN_cpp_type_test.cc index ca8583bdc92..811e1a5d783 100644 --- a/tests/gtests/functions/FN_cpp_type_test.cc +++ b/tests/gtests/functions/FN_cpp_type_test.cc @@ -19,6 +19,9 @@ #include "FN_cpp_type.hh" +namespace blender { +namespace FN { + static const int default_constructed_value = 1; static const int copy_constructed_value = 2; static const int move_constructed_value = 3; @@ -297,3 +300,6 @@ TEST(cpp_type, FillUninitialized) EXPECT_EQ(buffer2[8], copy_constructed_value); EXPECT_EQ(buffer2[9], 0); } + +} // namespace FN +} // namespace blender