]> git.seodisparate.com - EntityComponentMetaSystem/commitdiff
Split Meta.hpp
authorStephen Seo <seo.disparate@gmail.com>
Fri, 4 Mar 2016 11:20:56 +0000 (20:20 +0900)
committerStephen Seo <seo.disparate@gmail.com>
Fri, 4 Mar 2016 11:20:56 +0000 (20:20 +0900)
src/CMakeLists.txt
src/EC/Meta.hpp [deleted file]
src/EC/Meta/Contains.hpp [new file with mode: 0644]
src/EC/Meta/IndexOf.hpp [new file with mode: 0644]
src/EC/Meta/Meta.hpp [new file with mode: 0644]
src/EC/Meta/TypeList.hpp [new file with mode: 0644]
src/test/MetaTest.cpp

index 8b8ca510df2b36ddc7190a48eba1e826585a62ca..b32d9074055fa2457bae7cf39083b852e991c0d6 100644 (file)
@@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 3.0)
 project(EntityComponentSystem)
 
 set(EntityComponentSystem_HEADERS
-    EC/Meta.hpp)
+    EC/Meta/TypeList.hpp
+    EC/Meta/Contains.hpp
+    EC/Meta/IndexOf.hpp)
 
 add_library(EntityComponentSystem INTERFACE)
 target_include_directories(EntityComponentSystem INTERFACE ${CMAKE_SOURCE_DIR})
diff --git a/src/EC/Meta.hpp b/src/EC/Meta.hpp
deleted file mode 100644 (file)
index ab62b74..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#ifndef EC_META_HPP
-#define EC_META_HPP
-
-#include <type_traits>
-
-namespace EC
-{
-    namespace Meta
-    {
-        template <typename... Types>
-        struct TypeList
-        {
-            static constexpr std::size_t size{sizeof...(Types)};
-
-        };
-
-        template <typename T, typename... Types>
-        struct ContainsHelper :
-            std::false_type
-        {
-        };
-
-        template <typename T, typename Type, typename... Types>
-        struct ContainsHelper<T, TypeList<Type, Types...> > :
-            std::conditional<
-                std::is_same<T, Type>::value,
-                std::true_type,
-                ContainsHelper<T, TypeList<Types...> >
-            >::type
-        {
-        };
-
-        template <typename T, typename TTypeList>
-        using Contains = std::integral_constant<bool, ContainsHelper<T, TTypeList>::value >;
-
-        template <typename T, typename... Types>
-        struct IndexOf
-        {
-        };
-
-        template <typename T, typename... Types>
-        struct IndexOf<T, TypeList<T, Types...> > :
-            std::integral_constant<std::size_t, 0>
-        {
-        };
-
-        template <typename T, typename Type, typename... Types>
-        struct IndexOf<T, TypeList<Type, Types...> > :
-            std::integral_constant<std::size_t, 1 +
-                IndexOf<T, TypeList<Types...> >::value
-            >
-        {
-        };
-    }
-}
-
-#endif
-
diff --git a/src/EC/Meta/Contains.hpp b/src/EC/Meta/Contains.hpp
new file mode 100644 (file)
index 0000000..4dc32c8
--- /dev/null
@@ -0,0 +1,33 @@
+
+#ifndef EC_META_CONTAINS_HPP
+#define EC_META_CONTAINS_HPP
+
+#include "TypeList.hpp"
+
+namespace EC
+{
+    namespace Meta
+    {
+        template <typename T, typename... Types>
+        struct ContainsHelper :
+            std::false_type
+        {
+        };
+
+        template <typename T, typename Type, typename... Types>
+        struct ContainsHelper<T, TypeList<Type, Types...> > :
+            std::conditional<
+                std::is_same<T, Type>::value,
+                std::true_type,
+                ContainsHelper<T, TypeList<Types...> >
+            >::type
+        {
+        };
+
+        template <typename T, typename TTypeList>
+        using Contains = std::integral_constant<bool, ContainsHelper<T, TTypeList>::value >;
+    }
+}
+
+#endif
+
diff --git a/src/EC/Meta/IndexOf.hpp b/src/EC/Meta/IndexOf.hpp
new file mode 100644 (file)
index 0000000..8adf44f
--- /dev/null
@@ -0,0 +1,33 @@
+
+#ifndef EC_META_INDEX_OF_HPP
+#define EC_META_INDEX_OF_HPP
+
+#include "TypeList.hpp"
+
+namespace EC
+{
+    namespace Meta
+    {
+        template <typename T, typename... Types>
+        struct IndexOf
+        {
+        };
+
+        template <typename T, typename... Types>
+        struct IndexOf<T, TypeList<T, Types...> > :
+            std::integral_constant<std::size_t, 0>
+        {
+        };
+
+        template <typename T, typename Type, typename... Types>
+        struct IndexOf<T, TypeList<Type, Types...> > :
+            std::integral_constant<std::size_t, 1 +
+                IndexOf<T, TypeList<Types...> >::value
+            >
+        {
+        };
+    }
+}
+
+#endif
+
diff --git a/src/EC/Meta/Meta.hpp b/src/EC/Meta/Meta.hpp
new file mode 100644 (file)
index 0000000..69c2206
--- /dev/null
@@ -0,0 +1,5 @@
+
+#include "TypeList.hpp"
+#include "Contains.hpp"
+#include "IndexOf.hpp"
+
diff --git a/src/EC/Meta/TypeList.hpp b/src/EC/Meta/TypeList.hpp
new file mode 100644 (file)
index 0000000..560dbe9
--- /dev/null
@@ -0,0 +1,21 @@
+
+#ifndef EC_META_TYPE_LIST_HPP
+#define EC_META_TYPE_LIST_HPP
+
+#include <type_traits>
+
+namespace EC
+{
+    namespace Meta
+    {
+        template <typename... Types>
+        struct TypeList
+        {
+            static constexpr std::size_t size{sizeof...(Types)};
+
+        };
+    }
+}
+
+#endif
+
index 26c32fa9065ca4297e0997fabb7c08e5ded94b8b..3bb4ea8c95015b6de0c2aaf7cb0f6ea834afc016 100644 (file)
@@ -1,7 +1,7 @@
 
 #include <gtest/gtest.h>
 
-#include <EC/Meta.hpp>
+#include <EC/Meta/Meta.hpp>
 
 struct C0 {};
 struct C1 {};