فهرست منبع

static hashed_string::to_value -> hashed_string::value

Michele Caini 6 سال پیش
والد
کامیت
023267ecab
2فایلهای تغییر یافته به همراه9 افزوده شده و 9 حذف شده
  1. 3 3
      src/entt/core/hashed_string.hpp
  2. 6 6
      test/entt/core/hashed_string.cpp

+ 3 - 3
src/entt/core/hashed_string.hpp

@@ -94,7 +94,7 @@ public:
      * @return The numeric representation of the string.
      */
     template<std::size_t N>
-    static constexpr hash_type to_value(const value_type (&str)[N]) ENTT_NOEXCEPT {
+    static constexpr hash_type value(const value_type (&str)[N]) ENTT_NOEXCEPT {
         return helper(traits_type::offset, str);
     }
 
@@ -103,7 +103,7 @@ public:
      * @param wrapper Helps achieving the purpose by relying on overloading.
      * @return The numeric representation of the string.
      */
-    static hash_type to_value(const_wrapper wrapper) ENTT_NOEXCEPT {
+    static hash_type value(const_wrapper wrapper) ENTT_NOEXCEPT {
         return helper(traits_type::offset, wrapper.str);
     }
 
@@ -113,7 +113,7 @@ public:
      * @param size Length of the string to hash.
      * @return The numeric representation of the string.
      */
-    static hash_type to_value(const value_type *str, std::size_t size) ENTT_NOEXCEPT {
+    static hash_type value(const value_type *str, std::size_t size) ENTT_NOEXCEPT {
         ENTT_ID_TYPE partial{traits_type::offset};
         while(size--) { partial = (partial^(str++)[0])*traits_type::prime; }
         return partial;

+ 6 - 6
test/entt/core/hashed_string.cpp

@@ -52,15 +52,15 @@ TEST(HashedString, ToValue) {
 
     const char *foobar = "foobar";
 
-    ASSERT_EQ(entt::hashed_string::to_value(foobar), 0xbf9cf968);
+    ASSERT_EQ(entt::hashed_string::value(foobar), 0xbf9cf968);
     // how would you test a constexpr otherwise?
-    (void)std::integral_constant<hash_type, entt::hashed_string::to_value("quux")>{};
+    (void)std::integral_constant<hash_type, entt::hashed_string::value("quux")>{};
 }
 
 TEST(HashedString, StringView) {
     std::string str{"__foobar__"};
     std::string_view view{str.data()+2, 6};
-    ASSERT_EQ(entt::hashed_string::to_value(view.data(), view.size()), 0xbf9cf968);
+    ASSERT_EQ(entt::hashed_string::value(view.data(), view.size()), 0xbf9cf968);
 }
 
 TEST(HashedWString, Functionalities) {
@@ -111,15 +111,15 @@ TEST(HashedWString, ToValue) {
 
     const wchar_t *foobar = L"foobar";
 
-    ASSERT_EQ(entt::hashed_wstring::to_value(foobar), 0xbf9cf968);
+    ASSERT_EQ(entt::hashed_wstring::value(foobar), 0xbf9cf968);
     // how would you test a constexpr otherwise?
-    (void)std::integral_constant<hash_type, entt::hashed_wstring::to_value(L"quux")>{};
+    (void)std::integral_constant<hash_type, entt::hashed_wstring::value(L"quux")>{};
 }
 
 TEST(HashedWString, StringView) {
     std::wstring str{L"__foobar__"};
     std::wstring_view view{str.data()+2, 6};
-    ASSERT_EQ(entt::hashed_wstring::to_value(view.data(), view.size()), 0xbf9cf968);
+    ASSERT_EQ(entt::hashed_wstring::value(view.data(), view.size()), 0xbf9cf968);
 }
 
 TEST(BasicHashedString, DeductionGuide) {