Просмотр исходного кода

table: move it to the container module

Michele Caini 1 год назад
Родитель
Сommit
0b23b8f342

+ 1 - 1
CMakeLists.txt

@@ -118,6 +118,7 @@ if(ENTT_INCLUDE_HEADERS)
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/config/version.h>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/container/dense_map.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/container/dense_set.hpp>
+            $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/container/table.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/container/fwd.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/core/algorithm.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/core/any.hpp>
@@ -149,7 +150,6 @@ if(ENTT_INCLUDE_HEADERS)
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/entity/snapshot.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/entity/sparse_set.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/entity/storage.hpp>
-            $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/entity/table.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/entity/view.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/graph/adjacency_matrix.hpp>
             $<BUILD_INTERFACE:${EnTT_SOURCE_DIR}/src/entt/graph/dot.hpp>

+ 1 - 1
entt.imp

@@ -5,6 +5,7 @@
   # forward files
   { "include": [ "@[\"<].*/container/fwd\\.hpp[\">]", "private", "<entt/container/dense_map.hpp>", "public" ] },
   { "include": [ "@[\"<].*/container/fwd\\.hpp[\">]", "private", "<entt/container/dense_set.hpp>", "public" ] },
+  { "include": [ "@[\"<].*/container/fwd\\.hpp[\">]", "private", "<entt/container/table.hpp>", "public" ] },
   { "include": [ "@[\"<].*/core/fwd\\.hpp[\">]", "private", "<entt/core/any.hpp>", "public" ] },
   { "include": [ "@[\"<].*/core/fwd\\.hpp[\">]", "private", "<entt/core/family.hpp>", "public" ] },
   { "include": [ "@[\"<].*/core/fwd\\.hpp[\">]", "private", "<entt/core/hashed_string.hpp>", "public" ] },
@@ -24,7 +25,6 @@
   { "include": [ "@[\"<].*/entity/fwd\\.hpp[\">]", "private", "<entt/entity/snapshot.hpp>", "public" ] },
   { "include": [ "@[\"<].*/entity/fwd\\.hpp[\">]", "private", "<entt/entity/sparse_set.hpp>", "public" ] },
   { "include": [ "@[\"<].*/entity/fwd\\.hpp[\">]", "private", "<entt/entity/storage.hpp>", "public" ] },
-  { "include": [ "@[\"<].*/entity/fwd\\.hpp[\">]", "private", "<entt/entity/table.hpp>", "public" ] },
   { "include": [ "@[\"<].*/entity/fwd\\.hpp[\">]", "private", "<entt/entity/view.hpp>", "public" ] },
   { "include": [ "@[\"<].*/graph/fwd\\.hpp[\">]", "private", "<entt/graph/adjacency_matrix.hpp>", "public" ] },
   { "include": [ "@[\"<].*/graph/fwd\\.hpp[\">]", "private", "<entt/graph/dot.hpp>", "public" ] },

+ 11 - 0
src/entt/container/fwd.hpp

@@ -4,6 +4,7 @@
 #include <functional>
 #include <memory>
 #include <utility>
+#include <vector>
 
 namespace entt {
 
@@ -22,6 +23,16 @@ template<
     typename = std::allocator<Type>>
 class dense_set;
 
+template<typename...>
+class basic_table;
+
+/**
+ * @brief Alias declaration for the most common use case.
+ * @tparam Type Element types.
+ */
+template<typename... Type>
+using table = basic_table<std::vector<Type>...>;
+
 } // namespace entt
 
 #endif

+ 2 - 2
src/entt/entity/table.hpp → src/entt/container/table.hpp

@@ -1,5 +1,5 @@
-#ifndef ENTT_ENTITY_TABLE_HPP
-#define ENTT_ENTITY_TABLE_HPP
+#ifndef ENTT_CONTAINER_TABLE_HPP
+#define ENTT_CONTAINER_TABLE_HPP
 
 #include <cstddef>
 #include <iterator>

+ 0 - 11
src/entt/entity/fwd.hpp

@@ -4,7 +4,6 @@
 #include <cstdint>
 #include <memory>
 #include <type_traits>
-#include <vector>
 #include "../config/config.h"
 #include "../core/fwd.hpp"
 #include "../core/type_traits.hpp"
@@ -30,9 +29,6 @@ class basic_sparse_set;
 template<typename Type, typename = entity, typename = std::allocator<Type>, typename = void>
 class basic_storage;
 
-template<typename...>
-class basic_table;
-
 template<typename, typename>
 class basic_sigh_mixin;
 
@@ -76,13 +72,6 @@ using sparse_set = basic_sparse_set<>;
 template<typename Type>
 using storage = basic_storage<Type>;
 
-/**
- * @brief Alias declaration for the most common use case.
- * @tparam Type Element types.
- */
-template<typename... Type>
-using table = basic_table<std::vector<Type>...>;
-
 /**
  * @brief Alias declaration for the most common use case.
  * @tparam Type Underlying storage type.

+ 1 - 1
src/entt/entt.hpp

@@ -4,6 +4,7 @@
 #include "config/version.h"
 #include "container/dense_map.hpp"
 #include "container/dense_set.hpp"
+#include "container/table.hpp"
 #include "core/algorithm.hpp"
 #include "core/any.hpp"
 #include "core/attribute.h"
@@ -32,7 +33,6 @@
 #include "entity/snapshot.hpp"
 #include "entity/sparse_set.hpp"
 #include "entity/storage.hpp"
-#include "entity/table.hpp"
 #include "entity/view.hpp"
 #include "graph/adjacency_matrix.hpp"
 #include "graph/dot.hpp"

+ 1 - 1
test/CMakeLists.txt

@@ -226,6 +226,7 @@ SETUP_BASIC_TEST(version entt/config/version.cpp)
 
 SETUP_BASIC_TEST(dense_map entt/container/dense_map.cpp)
 SETUP_BASIC_TEST(dense_set entt/container/dense_set.cpp)
+SETUP_BASIC_TEST(table entt/container/table.cpp)
 
 # Test core
 
@@ -263,7 +264,6 @@ SETUP_BASIC_TEST(storage_entity entt/entity/storage_entity.cpp)
 SETUP_BASIC_TEST(storage_no_instance entt/entity/storage_no_instance.cpp)
 SETUP_BASIC_TEST(storage_utility entt/entity/storage_utility.cpp)
 SETUP_BASIC_TEST(storage_utility_no_mixin entt/entity/storage_utility.cpp ENTT_NO_MIXIN)
-SETUP_BASIC_TEST(table entt/entity/table.cpp)
 SETUP_BASIC_TEST(view entt/entity/view.cpp)
 
 # Test graph

+ 1 - 1
test/entt/entity/table.cpp → test/entt/container/table.cpp

@@ -3,8 +3,8 @@
 #include <type_traits>
 #include <utility>
 #include <gtest/gtest.h>
+#include <entt/container/table.hpp>
 #include <entt/core/iterator.hpp>
-#include <entt/entity/table.hpp>
 #include "../../common/config.h"
 #include "../../common/linter.hpp"
 #include "../../common/throwing_allocator.hpp"