entity module: added utility.hpp, cleaned up fwd.hpp

This commit is contained in:
Michele Caini
2020-02-28 15:03:42 +01:00
parent 0240453b07
commit 1e962754cc
9 changed files with 57 additions and 36 deletions

View File

@@ -159,6 +159,10 @@ constexpr bool operator!=(const Entity entity, null other) ENTT_NOEXCEPT {
*/
/*! @brief Alias declaration for the most common use case. */
ENTT_OPAQUE_TYPE(entity, ENTT_ID_TYPE);
/**
* @brief Compile-time constant for null entities.
*

View File

@@ -3,44 +3,11 @@
#include "../config/config.h"
#include "../core/type_traits.hpp"
namespace entt {
/**
* @brief Alias for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
struct exclude_t: type_list<Type...> {};
/**
* @brief Variable template for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr exclude_t<Type...> exclude{};
/**
* @brief Alias for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
struct get_t: type_list<Type...>{};
/**
* @brief Variable template for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr get_t<Type...> get{};
/*! @class basic_registry */
template <typename>
class basic_registry;
@@ -78,7 +45,7 @@ template<typename>
class basic_continuous_loader;
/*! @brief Alias declaration for the most common use case. */
ENTT_OPAQUE_TYPE(entity, ENTT_ID_TYPE);
enum class entity: ENTT_ID_TYPE;
/*! @brief Alias declaration for the most common use case. */
using registry = basic_registry<entity>;

View File

@@ -9,6 +9,8 @@
#include "../core/type_traits.hpp"
#include "sparse_set.hpp"
#include "storage.hpp"
#include "utility.hpp"
#include "entity.hpp"
#include "fwd.hpp"

View File

@@ -11,6 +11,7 @@
#include "../core/type_traits.hpp"
#include "registry.hpp"
#include "storage.hpp"
#include "utility.hpp"
#include "entity.hpp"
#include "fwd.hpp"

View File

@@ -19,6 +19,7 @@
#include "sparse_set.hpp"
#include "snapshot.hpp"
#include "storage.hpp"
#include "utility.hpp"
#include "entity.hpp"
#include "group.hpp"
#include "view.hpp"

View File

@@ -9,7 +9,6 @@
#include <type_traits>
#include "../config/config.h"
#include "sparse_set.hpp"
#include "entity.hpp"
#include "fwd.hpp"

View File

@@ -0,0 +1,46 @@
#ifndef ENTT_ENTITY_UTILITY_HPP
#define ENTT_ENTITY_UTILITY_HPP
#include "../core/type_traits.hpp"
namespace entt {
/**
* @brief Alias for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
struct exclude_t: type_list<Type...> {};
/**
* @brief Variable template for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr exclude_t<Type...> exclude{};
/**
* @brief Alias for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
struct get_t: type_list<Type...>{};
/**
* @brief Variable template for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr get_t<Type...> get{};
}
#endif

View File

@@ -12,6 +12,7 @@
#include "../core/type_traits.hpp"
#include "sparse_set.hpp"
#include "storage.hpp"
#include "utility.hpp"
#include "entity.hpp"
#include "fwd.hpp"
@@ -76,7 +77,6 @@ class basic_view<Entity, exclude_t<Exclude...>, Component...> {
using underlying_iterator_type = typename sparse_set<Entity>::iterator_type;
using unchecked_type = std::array<const sparse_set<Entity> *, (sizeof...(Component) - 1)>;
using filter_type = std::array<const sparse_set<Entity> *, sizeof...(Exclude)>;
using traits_type = entt_traits<std::underlying_type_t<Entity>>;
class iterator {
friend class basic_view<Entity, exclude_t<Exclude...>, Component...>;

View File

@@ -17,6 +17,7 @@
#include "entity/snapshot.hpp"
#include "entity/sparse_set.hpp"
#include "entity/storage.hpp"
#include "entity/utility.hpp"
#include "entity/view.hpp"
#include "locator/locator.hpp"
#include "meta/factory.hpp"