test_info:🆔 make the family-like fallback work across boundaries

This commit is contained in:
Michele Caini
2019-12-22 01:02:46 +01:00
parent c51c88a17c
commit 7cfd3957de
11 changed files with 25 additions and 29 deletions

3
TODO
View File

@@ -20,11 +20,12 @@
* sparse set: there exists an alternative to paginated sparse arrays?
* see warning (vs2017 only): d:\a\entt\entt\src\entt\entity\registry.hpp(108)
* remove duktape example (and eventually provide a new one)?
* meta: rebind meta types from any across boundaries (eg conv corner case across boundary)
* registry
- ::assure -> pool_type<T> &
- ::group improve, reduce code
* Mission: get rid of named types
- make family-like fallback for type_info::id work across boundaries
- add tests for type_info fallback and type_info specializations
- update doc: dispatcher, emitter, registry, meta, across boundaries
- review and suppress warnings, if any

View File

@@ -53,10 +53,12 @@
#endif
#if defined _MSC_VER
# define ENTT_PRETTY_FUNCTION __FUNCSIG__
#elif defined __GNUC__
# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
#ifndef ENTT_STANDARD_CPP
# if defined _MSC_VER
# define ENTT_PRETTY_FUNCTION __FUNCSIG__
# elif defined __GNUC__
# define ENTT_PRETTY_FUNCTION __PRETTY_FUNCTION__
# endif
#endif

View File

@@ -3,6 +3,7 @@
#include "../config/config.h"
#include "../core/attribute.h"
#include "hashed_string.hpp"
@@ -14,18 +15,14 @@ namespace entt {
* @tparam Type Type for which to generate an identifier.
*/
template<typename Type, typename = void>
struct type_info {
struct ENTT_API type_info {
/**
* @brief Returns the numeric representation of a given type.
* @return The numeric representation of the given type.
*/
#if defined _MSC_VER
#if defined ENTT_PRETTY_FUNCTION
static constexpr ENTT_ID_TYPE id() ENTT_NOEXCEPT {
return entt::hashed_string{__FUNCSIG__};
}
#elif defined __GNUC__
static constexpr ENTT_ID_TYPE id() ENTT_NOEXCEPT {
return entt::hashed_string{__PRETTY_FUNCTION__};
return entt::hashed_string{ENTT_PRETTY_FUNCTION};
}
#else
static ENTT_ID_TYPE id() ENTT_NOEXCEPT;
@@ -41,7 +38,7 @@ struct type_info {
namespace internal {
struct type_id_generator {
struct ENTT_API type_id_generator {
static ENTT_ID_TYPE next() ENTT_NOEXCEPT {
static ENTT_ID_TYPE value{};
return value++;

View File

@@ -7,4 +7,4 @@ struct message {
struct event {};
#endif // ENTT_LIB_DISPATCHER_TYPES_H
#endif

View File

@@ -13,4 +13,4 @@ struct message {
struct event {};
#endif // ENTT_LIB_EMITTER_TYPES_H
#endif

View File

@@ -1,16 +1,14 @@
#ifndef ENTT_LIB_META_TYPES_H
#define ENTT_LIB_META_TYPES_H
#include <entt/core/attribute.h>
struct ENTT_API position {
struct position {
int x{};
int y{};
};
struct ENTT_API velocity {
struct velocity {
double dx{};
double dy{};
};
#endif // ENTT_LIB_META_TYPES_H
#endif

View File

@@ -1,16 +1,14 @@
#ifndef ENTT_LIB_REGISTRY_TYPES_H
#define ENTT_LIB_REGISTRY_TYPES_H
#include <entt/core/attribute.h>
struct ENTT_API position {
struct position {
int x;
int y;
};
struct ENTT_API velocity {
struct velocity {
double dx;
double dy;
};
#endif // ENTT_LIB_REGISTRY_TYPES_H
#endif

View File

@@ -7,4 +7,4 @@ struct message {
struct event {};
#endif // ENTT_PLUGIN_DISPATCHER_TYPES_H
#endif

View File

@@ -13,4 +13,4 @@ struct message {
struct event {};
#endif // ENTT_PLUGIN_EMITTER_TYPES_H
#endif

View File

@@ -18,4 +18,4 @@ struct userdata {
entt::meta_any any;
};
#endif // ENTT_PLUGIN_META_TYPES_H
#endif

View File

@@ -11,4 +11,4 @@ struct velocity {
double dy;
};
#endif // ENTT_PLUGIN_REGISTRY_TYPES_H
#endif