Explorar o código

naming convention

Michele Caini %!s(int64=7) %!d(string=hai) anos
pai
achega
b699797a40

+ 5 - 5
src/entt/entity/prototype.hpp

@@ -37,15 +37,15 @@ namespace entt {
  */
 template<typename Entity>
 class Prototype final {
-    using fn_type = void(*)(const Prototype &, Registry<Entity> &, const Entity);
+    using basic_fn_type = void(const Prototype &, Registry<Entity> &, const Entity);
     using component_type = typename Registry<Entity>::component_type;
 
     template<typename Component>
     struct Wrapper { Component component; };
 
     struct Handler {
-        fn_type accommodate;
-        fn_type assign;
+        basic_fn_type *accommodate;
+        basic_fn_type *assign;
     };
 
     void release() {
@@ -131,12 +131,12 @@ public:
      */
     template<typename Component, typename... Args>
     Component & set(Args &&... args) {
-        fn_type accommodate = [](const Prototype &prototype, Registry<Entity> &other, const Entity dst) {
+        basic_fn_type *accommodate = [](const Prototype &prototype, Registry<Entity> &other, const Entity dst) {
             const auto &wrapper = prototype.registry->template get<Wrapper<Component>>(prototype.entity);
             other.template accommodate<Component>(dst, wrapper.component);
         };
 
-        fn_type assign = [](const Prototype &prototype, Registry<Entity> &other, const Entity dst) {
+        basic_fn_type *assign = [](const Prototype &prototype, Registry<Entity> &other, const Entity dst) {
             if(!other.template has<Component>(dst)) {
                 const auto &wrapper = prototype.registry->template get<Wrapper<Component>>(prototype.entity);
                 other.template accommodate<Component>(dst, wrapper.component);

+ 4 - 4
src/entt/entity/registry.hpp

@@ -1471,10 +1471,10 @@ public:
      * @return A temporary object to use to take snasphosts.
      */
     Snapshot<Entity> snapshot() const ENTT_NOEXCEPT {
-        using follow_fn_type = entity_type(*)(const Registry &, const entity_type);
+        using follow_fn_type = entity_type(const Registry &, const entity_type);
         const entity_type seed = available ? (next | (entities[next] & ~traits_type::entity_mask)) : next;
 
-        follow_fn_type follow = [](const Registry &registry, const entity_type entity) -> entity_type {
+        follow_fn_type *follow = [](const Registry &registry, const entity_type entity) -> entity_type {
             const auto &entities = registry.entities;
             const auto entt = entity & traits_type::entity_mask;
             const auto next = entities[entt] & traits_type::entity_mask;
@@ -1500,9 +1500,9 @@ public:
      * @return A temporary object to use to load snasphosts.
      */
     SnapshotLoader<Entity> restore() ENTT_NOEXCEPT {
-        using assure_fn_type = void(*)(Registry &, const entity_type, const bool);
+        using assure_fn_type = void(Registry &, const entity_type, const bool);
 
-        assure_fn_type assure = [](Registry &registry, const entity_type entity, const bool destroyed) {
+        assure_fn_type *assure = [](Registry &registry, const entity_type entity, const bool destroyed) {
             using promotion_type = std::conditional_t<sizeof(size_type) >= sizeof(entity_type), size_type, entity_type>;
             // explicit promotion to avoid warnings with std::uint16_t
             const auto entt = promotion_type{entity} & traits_type::entity_mask;

+ 6 - 6
src/entt/entity/snapshot.hpp

@@ -39,9 +39,9 @@ class Snapshot final {
     /*! @brief A registry is allowed to create snapshots. */
     friend class Registry<Entity>;
 
-    using follow_fn_type = Entity(*)(const Registry<Entity> &, const Entity);
+    using follow_fn_type = Entity(const Registry<Entity> &, const Entity);
 
-    Snapshot(const Registry<Entity> &registry, Entity seed, follow_fn_type follow) ENTT_NOEXCEPT
+    Snapshot(const Registry<Entity> &registry, Entity seed, follow_fn_type *follow) ENTT_NOEXCEPT
         : registry{registry},
           seed{seed},
           follow{follow}
@@ -243,7 +243,7 @@ public:
 private:
     const Registry<Entity> &registry;
     const Entity seed;
-    follow_fn_type follow;
+    follow_fn_type *follow;
 };
 
 
@@ -262,9 +262,9 @@ class SnapshotLoader final {
     /*! @brief A registry is allowed to create snapshot loaders. */
     friend class Registry<Entity>;
 
-    using assure_fn_type = void(*)(Registry<Entity> &, const Entity, const bool);
+    using assure_fn_type = void(Registry<Entity> &, const Entity, const bool);
 
-    SnapshotLoader(Registry<Entity> &registry, assure_fn_type assure_fn) ENTT_NOEXCEPT
+    SnapshotLoader(Registry<Entity> &registry, assure_fn_type *assure_fn) ENTT_NOEXCEPT
         : registry{registry},
           assure_fn{assure_fn}
     {
@@ -406,7 +406,7 @@ public:
 
 private:
     Registry<Entity> &registry;
-    assure_fn_type assure_fn;
+    assure_fn_type *assure_fn;
 };
 
 

+ 4 - 4
src/entt/process/scheduler.hpp

@@ -44,13 +44,13 @@ template<typename Delta>
 class Scheduler final {
     struct ProcessHandler final {
         using instance_type = std::unique_ptr<void, void(*)(void *)>;
-        using update_type = bool(*)(ProcessHandler &, Delta, void *);
-        using abort_type = void(*)(ProcessHandler &, bool);
+        using update_fn_type = bool(ProcessHandler &, Delta, void *);
+        using abort_fn_type = void(ProcessHandler &, bool);
         using next_type = std::unique_ptr<ProcessHandler>;
 
         instance_type instance;
-        update_type update;
-        abort_type abort;
+        update_fn_type *update;
+        abort_fn_type *abort;
         next_type next;
     };
 

+ 4 - 4
src/entt/signal/delegate.hpp

@@ -34,8 +34,8 @@ class Delegate;
  */
 template<typename Ret, typename... Args>
 class Delegate<Ret(Args...)> final {
-    using proto_type = Ret(*)(void *, Args...);
-    using stub_type = std::pair<void *, proto_type>;
+    using proto_fn_type = Ret(void *, Args...);
+    using stub_type = std::pair<void *, proto_fn_type *>;
 
     template<Ret(*Function)(Args...)>
     static Ret proto(void *, Args... args) {
@@ -50,7 +50,7 @@ class Delegate<Ret(Args...)> final {
 public:
     /*! @brief Default constructor. */
     Delegate() ENTT_NOEXCEPT
-        : stub{std::make_pair(nullptr, proto_type{})}
+        : stub{}
     {}
 
     /**
@@ -93,7 +93,7 @@ public:
      * After a reset, a delegate can be safely invoked with no effect.
      */
     void reset() ENTT_NOEXCEPT {
-        stub = std::make_pair(nullptr, proto_type{});
+        stub.second = nullptr;
     }
 
     /**

+ 8 - 8
src/entt/signal/sigh.hpp

@@ -26,12 +26,12 @@ struct Invoker;
 
 template<typename Ret, typename... Args, typename Collector>
 struct Invoker<Ret(Args...), Collector> {
-    using proto_type = Ret(*)(void *, Args...);
-    using call_type = std::pair<void *, proto_type>;
+    using proto_fn_type = Ret(void *, Args...);
+    using call_type = std::pair<void *, proto_fn_type *>;
 
     virtual ~Invoker() = default;
 
-    bool invoke(Collector &collector, proto_type proto, void *instance, Args... args) const {
+    bool invoke(Collector &collector, proto_fn_type *proto, void *instance, Args... args) const {
         return collector(proto(instance, args...));
     }
 };
@@ -39,12 +39,12 @@ struct Invoker<Ret(Args...), Collector> {
 
 template<typename... Args, typename Collector>
 struct Invoker<void(Args...), Collector> {
-    using proto_type = void(*)(void *, Args...);
-    using call_type = std::pair<void *, proto_type>;
+    using proto_fn_type = void(void *, Args...);
+    using call_type = std::pair<void *, proto_fn_type *>;
 
     virtual ~Invoker() = default;
 
-    bool invoke(Collector &, proto_type proto, void *instance, Args... args) const {
+    bool invoke(Collector &, proto_fn_type *proto, void *instance, Args... args) const {
         return (proto(instance, args...), true);
     }
 };
@@ -132,8 +132,8 @@ class Sink<Ret(Args...)> final {
     template<typename, typename>
     friend class SigH;
 
-    using proto_type = Ret(*)(void *, Args...);
-    using call_type = std::pair<void *, proto_type>;
+    using proto_fn_type = Ret(void *, Args...);
+    using call_type = std::pair<void *, proto_fn_type *>;
 
     template<Ret(*Function)(Args...)>
     static Ret proto(void *, Args... args) {