diff --git a/conan/test_package/test_package.cpp b/conan/test_package/test_package.cpp index 9c99649c7..138d540f1 100644 --- a/conan/test_package/test_package.cpp +++ b/conan/test_package/test_package.cpp @@ -15,7 +15,7 @@ void update(entt::registry ®istry) { auto view = registry.view(); for(auto entity: view) { - // gets only the components that are going to be used ... + // gets only the elements that are going to be used ... auto &vel = view.get(entity); @@ -28,7 +28,7 @@ void update(entt::registry ®istry) { void update(std::uint64_t dt, entt::registry ®istry) { registry.view().each([dt](auto &pos, auto &vel) { - // gets all the components of the view at once ... + // gets all the elements of the view at once ... pos.x += vel.dx * dt; pos.y += vel.dy * dt; diff --git a/src/entt/entity/fwd.hpp b/src/entt/entity/fwd.hpp index ce33f35db..abf127bc2 100644 --- a/src/entt/entity/fwd.hpp +++ b/src/entt/entity/fwd.hpp @@ -66,7 +66,7 @@ using sparse_set = basic_sparse_set<>; /** * @brief Alias declaration for the most common use case. - * @tparam Type Type of objects assigned to the entities. + * @tparam Type Element type. */ template using storage = basic_storage; @@ -140,7 +140,7 @@ template inline constexpr exclude_t exclude{}; /** - * @brief Alias for lists of observed components. + * @brief Alias for lists of observed elements. * @tparam Type List of types. */ template @@ -150,14 +150,14 @@ struct get_t final: type_list { }; /** - * @brief Variable template for lists of observed components. + * @brief Variable template for lists of observed elements. * @tparam Type List of types. */ template inline constexpr get_t get{}; /** - * @brief Alias for lists of owned components. + * @brief Alias for lists of owned elements. * @tparam Type List of types. */ template @@ -167,7 +167,7 @@ struct owned_t final: type_list { }; /** - * @brief Variable template for lists of owned components. + * @brief Variable template for lists of owned elements. * @tparam Type List of types. */ template diff --git a/src/entt/entity/group.hpp b/src/entt/entity/group.hpp index 244d9c021..29833ec15 100644 --- a/src/entt/entity/group.hpp +++ b/src/entt/entity/group.hpp @@ -268,7 +268,7 @@ class basic_group; * Iterators aren't invalidated if: * * * New elements are added to the storage. - * * The entity currently pointed is modified (for example, components are added + * * The entity currently pointed is modified (for example, elements are added * or removed from it). * * The entity currently pointed is destroyed. * @@ -332,9 +332,9 @@ public: } /** - * @brief Returns the storage for a given component type, if any. - * @tparam Type Type of component of which to return the storage. - * @return The storage for the given component type. + * @brief Returns the storage for a given element type, if any. + * @tparam Type Type of element of which to return the storage. + * @return The storage for the given element type. */ template [[nodiscard]] auto *storage() const noexcept { @@ -487,11 +487,11 @@ public: } /** - * @brief Returns the components assigned to the given entity. - * @tparam Type Type of the component to get. - * @tparam Other Other types of components to get. + * @brief Returns the elements assigned to the given entity. + * @tparam Type Type of the element to get. + * @tparam Other Other types of elements to get. * @param entt A valid identifier. - * @return The components assigned to the entity. + * @return The elements assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -499,10 +499,10 @@ public: } /** - * @brief Returns the components assigned to the given entity. - * @tparam Index Indexes of the components to get. + * @brief Returns the elements assigned to the given entity. + * @tparam Index Indexes of the elements to get. * @param entt A valid identifier. - * @return The components assigned to the entity. + * @return The elements assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -518,12 +518,12 @@ public: } /** - * @brief Iterates entities and components and applies the given function + * @brief Iterates entities and elements and applies the given function * object to them. * * The function object is invoked for each entity. It is provided with the - * entity itself and a set of references to non-empty components. The - * _constness_ of the components is as requested.
+ * entity itself and a set of references to non-empty elements. The + * _constness_ of the elements is as requested.
* The signature of the function must be equivalent to one of the following * forms: * @@ -554,8 +554,8 @@ public: * @brief Returns an iterable object to use to _visit_ a group. * * The iterable object returns tuples that contain the current entity and a - * set of references to its non-empty components. The _constness_ of the - * components is as requested. + * set of references to its non-empty elements. The _constness_ of the + * elements is as requested. * * @note * Empty types aren't explicitly instantiated and therefore they are never @@ -592,8 +592,8 @@ public: * * An iterator past the last element of the range to sort. * * A comparison function to use to compare the elements. * - * @tparam Type Optional type of component to compare. - * @tparam Other Other optional types of components to compare. + * @tparam Type Optional type of element to compare. + * @tparam Other Other optional types of elements to compare. * @tparam Compare Type of comparison function object. * @tparam Sort Type of sort function object. * @tparam Args Types of arguments to forward to the sort function object. @@ -611,7 +611,7 @@ public: * * @sa sort * - * @tparam Index Optional indexes of components to compare. + * @tparam Index Optional indexes of elements to compare. * @tparam Compare Type of comparison function object. * @tparam Sort Type of sort function object. * @tparam Args Types of arguments to forward to the sort function object. @@ -668,7 +668,7 @@ private: * * * It's guaranteed that the entity list is tightly packed in memory for fast * iterations. - * * It's guaranteed that all components in the owned storage are tightly packed + * * It's guaranteed that all elements in the owned storage are tightly packed * in memory for even faster iterations and to allow direct access. * * They stay true to the order of the owned storage and all instances have the * same order in memory. @@ -680,7 +680,7 @@ private: * Iterators aren't invalidated if: * * * New elements are added to the storage. - * * The entity currently pointed is modified (for example, components are added + * * The entity currently pointed is modified (for example, elements are added * or removed from it). * * The entity currently pointed is destroyed. * @@ -745,9 +745,9 @@ public: } /** - * @brief Returns the storage for a given component type, if any. - * @tparam Type Type of component of which to return the storage. - * @return The storage for the given component type. + * @brief Returns the storage for a given element type, if any. + * @tparam Type Type of element of which to return the storage. + * @return The storage for the given element type. */ template [[nodiscard]] auto *storage() const noexcept { @@ -885,11 +885,11 @@ public: } /** - * @brief Returns the components assigned to the given entity. - * @tparam Type Type of the component to get. - * @tparam Other Other types of components to get. + * @brief Returns the elements assigned to the given entity. + * @tparam Type Type of the element to get. + * @tparam Other Other types of elements to get. * @param entt A valid identifier. - * @return The components assigned to the entity. + * @return The elements assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -897,10 +897,10 @@ public: } /** - * @brief Returns the components assigned to the given entity. - * @tparam Index Indexes of the components to get. + * @brief Returns the elements assigned to the given entity. + * @tparam Index Indexes of the elements to get. * @param entt A valid identifier. - * @return The components assigned to the entity. + * @return The elements assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -916,12 +916,12 @@ public: } /** - * @brief Iterates entities and components and applies the given function + * @brief Iterates entities and elements and applies the given function * object to them. * * The function object is invoked for each entity. It is provided with the - * entity itself and a set of references to non-empty components. The - * _constness_ of the components is as requested.
+ * entity itself and a set of references to non-empty elements. The + * _constness_ of the elements is as requested.
* The signature of the function must be equivalent to one of the following * forms: * @@ -952,8 +952,8 @@ public: * @brief Returns an iterable object to use to _visit_ a group. * * The iterable object returns tuples that contain the current entity and a - * set of references to its non-empty components. The _constness_ of the - * components is as requested. + * set of references to its non-empty elements. The _constness_ of the + * elements is as requested. * * @note * Empty types aren't explicitly instantiated and therefore they are never @@ -991,8 +991,8 @@ public: * * An iterator past the last element of the range to sort. * * A comparison function to use to compare the elements. * - * @tparam Type Optional type of component to compare. - * @tparam Other Other optional types of components to compare. + * @tparam Type Optional type of element to compare. + * @tparam Other Other optional types of elements to compare. * @tparam Compare Type of comparison function object. * @tparam Sort Type of sort function object. * @tparam Args Types of arguments to forward to the sort function object. @@ -1010,7 +1010,7 @@ public: * * @sa sort * - * @tparam Index Optional indexes of components to compare. + * @tparam Index Optional indexes of elements to compare. * @tparam Compare Type of comparison function object. * @tparam Sort Type of sort function object. * @tparam Args Types of arguments to forward to the sort function object. diff --git a/src/entt/entity/handle.hpp b/src/entt/entity/handle.hpp index 59f5e448b..1691e6f2d 100644 --- a/src/entt/entity/handle.hpp +++ b/src/entt/entity/handle.hpp @@ -203,137 +203,137 @@ struct basic_handle { } /** - * @brief Assigns the given component to a handle. - * @tparam Component Type of component to create. - * @tparam Args Types of arguments to use to construct the component. - * @param args Parameters to use to initialize the component. - * @return A reference to the newly created component. + * @brief Assigns the given element to a handle. + * @tparam Type Type of element to create. + * @tparam Args Types of arguments to use to construct the element. + * @param args Parameters to use to initialize the element. + * @return A reference to the newly created element. */ - template + template decltype(auto) emplace(Args &&...args) const { - static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template emplace(entt, std::forward(args)...); + static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); + return reg->template emplace(entt, std::forward(args)...); } /** - * @brief Assigns or replaces the given component for a handle. - * @tparam Component Type of component to assign or replace. - * @tparam Args Types of arguments to use to construct the component. - * @param args Parameters to use to initialize the component. - * @return A reference to the newly created component. + * @brief Assigns or replaces the given element for a handle. + * @tparam Type Type of element to assign or replace. + * @tparam Args Types of arguments to use to construct the element. + * @param args Parameters to use to initialize the element. + * @return A reference to the newly created element. */ - template + template decltype(auto) emplace_or_replace(Args &&...args) const { - static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template emplace_or_replace(entt, std::forward(args)...); + static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); + return reg->template emplace_or_replace(entt, std::forward(args)...); } /** - * @brief Patches the given component for a handle. - * @tparam Component Type of component to patch. + * @brief Patches the given element for a handle. + * @tparam Type Type of element to patch. * @tparam Func Types of the function objects to invoke. * @param func Valid function objects. - * @return A reference to the patched component. + * @return A reference to the patched element. */ - template + template decltype(auto) patch(Func &&...func) const { - static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template patch(entt, std::forward(func)...); + static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); + return reg->template patch(entt, std::forward(func)...); } /** - * @brief Replaces the given component for a handle. - * @tparam Component Type of component to replace. - * @tparam Args Types of arguments to use to construct the component. - * @param args Parameters to use to initialize the component. - * @return A reference to the component being replaced. + * @brief Replaces the given element for a handle. + * @tparam Type Type of element to replace. + * @tparam Args Types of arguments to use to construct the element. + * @param args Parameters to use to initialize the element. + * @return A reference to the element being replaced. */ - template + template decltype(auto) replace(Args &&...args) const { - static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template replace(entt, std::forward(args)...); + static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); + return reg->template replace(entt, std::forward(args)...); } /** - * @brief Removes the given components from a handle. - * @tparam Component Types of components to remove. - * @return The number of components actually removed. + * @brief Removes the given elements from a handle. + * @tparam Type Types of elements to remove. + * @return The number of elements actually removed. */ - template + template size_type remove() const { - static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Component> && ...), "Invalid type"); - return reg->template remove(entt); + static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); + return reg->template remove(entt); } /** - * @brief Erases the given components from a handle. - * @tparam Component Types of components to erase. + * @brief Erases the given elements from a handle. + * @tparam Type Types of elements to erase. */ - template + template void erase() const { - static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Component> && ...), "Invalid type"); - reg->template erase(entt); + static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); + reg->template erase(entt); } /** - * @brief Checks if a handle has all the given components. - * @tparam Component Components for which to perform the check. - * @return True if the handle has all the components, false otherwise. + * @brief Checks if a handle has all the given elements. + * @tparam Type Elements for which to perform the check. + * @return True if the handle has all the elements, false otherwise. */ - template + template [[nodiscard]] decltype(auto) all_of() const { - return reg->template all_of(entt); + return reg->template all_of(entt); } /** - * @brief Checks if a handle has at least one of the given components. - * @tparam Component Components for which to perform the check. - * @return True if the handle has at least one of the given components, + * @brief Checks if a handle has at least one of the given elements. + * @tparam Type Elements for which to perform the check. + * @return True if the handle has at least one of the given elements, * false otherwise. */ - template + template [[nodiscard]] decltype(auto) any_of() const { - return reg->template any_of(entt); + return reg->template any_of(entt); } /** - * @brief Returns references to the given components for a handle. - * @tparam Component Types of components to get. - * @return References to the components owned by the handle. + * @brief Returns references to the given elements for a handle. + * @tparam Type Types of elements to get. + * @return References to the elements owned by the handle. */ - template + template [[nodiscard]] decltype(auto) get() const { - static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Component> && ...), "Invalid type"); - return reg->template get(entt); + static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); + return reg->template get(entt); } /** - * @brief Returns a reference to the given component for a handle. - * @tparam Component Type of component to get. - * @tparam Args Types of arguments to use to construct the component. - * @param args Parameters to use to initialize the component. - * @return Reference to the component owned by the handle. + * @brief Returns a reference to the given element for a handle. + * @tparam Type Type of element to get. + * @tparam Args Types of arguments to use to construct the element. + * @param args Parameters to use to initialize the element. + * @return Reference to the element owned by the handle. */ - template + template [[nodiscard]] decltype(auto) get_or_emplace(Args &&...args) const { - static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); - return reg->template get_or_emplace(entt, std::forward(args)...); + static_assert(((sizeof...(Scope) == 0) || ... || std::is_same_v), "Invalid type"); + return reg->template get_or_emplace(entt, std::forward(args)...); } /** - * @brief Returns pointers to the given components for a handle. - * @tparam Component Types of components to get. - * @return Pointers to the components owned by the handle. + * @brief Returns pointers to the given elements for a handle. + * @tparam Type Types of elements to get. + * @return Pointers to the elements owned by the handle. */ - template + template [[nodiscard]] auto try_get() const { - static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Component> && ...), "Invalid type"); - return reg->template try_get(entt); + static_assert(sizeof...(Scope) == 0 || (type_list_contains_v, Type> && ...), "Invalid type"); + return reg->template try_get(entt); } /** - * @brief Checks if a handle has components assigned. - * @return True if the handle has no components assigned, false otherwise. + * @brief Checks if a handle has elements assigned. + * @return True if the handle has no elements assigned, false otherwise. */ [[nodiscard]] bool orphan() const { return reg->orphan(entt); diff --git a/src/entt/entity/helper.hpp b/src/entt/entity/helper.hpp index 0acf6ddc8..46eb0398d 100644 --- a/src/entt/entity/helper.hpp +++ b/src/entt/entity/helper.hpp @@ -100,10 +100,10 @@ private: /** * @brief Helper to create a listener that directly invokes a member function. - * @tparam Member Member function to invoke on a component of the given type. + * @tparam Member Member function to invoke on an element of the given type. * @tparam Registry Basic registry type. - * @param reg A registry that contains the given entity and its components. - * @param entt Entity from which to get the component. + * @param reg A registry that contains the given entity and its elements. + * @param entt Entity from which to get the element. */ template>> void invoke(Registry ®, const typename Registry::entity_type entt) { @@ -114,16 +114,16 @@ void invoke(Registry ®, const typename Registry::entity_type entt) { } /** - * @brief Returns the entity associated with a given component. + * @brief Returns the entity associated with a given element. * * @warning * Currently, this function only works correctly with the default storage as it - * makes assumptions about how the components are laid out. + * makes assumptions about how the elements are laid out. * * @tparam Args Storage type template parameters. - * @param storage A storage that contains the given component. - * @param instance A valid component instance. - * @return The entity associated with the given component. + * @param storage A storage that contains the given element. + * @param instance A valid element instance. + * @return The entity associated with the given element. */ template typename basic_storage::entity_type to_entity(const basic_storage &storage, const typename basic_storage::value_type &instance) { diff --git a/src/entt/entity/observer.hpp b/src/entt/entity/observer.hpp index d38663e33..f15c233b9 100644 --- a/src/entt/entity/observer.hpp +++ b/src/entt/entity/observer.hpp @@ -38,8 +38,8 @@ template<> struct basic_collector<> { /** * @brief Adds a grouping matcher to the collector. - * @tparam AllOf Types of components tracked by the matcher. - * @tparam NoneOf Types of components used to filter out entities. + * @tparam AllOf Types of elements tracked by the matcher. + * @tparam NoneOf Types of elements used to filter out entities. * @return The updated collector. */ template @@ -49,7 +49,7 @@ struct basic_collector<> { /** * @brief Adds an observing matcher to the collector. - * @tparam AnyOf Type of component for which changes should be detected. + * @tparam AnyOf Type of element for which changes should be detected. * @return The updated collector. */ template @@ -73,8 +73,8 @@ struct basic_collector, type_list, Rule /** * @brief Adds a grouping matcher to the collector. - * @tparam AllOf Types of components tracked by the matcher. - * @tparam NoneOf Types of components used to filter out entities. + * @tparam AllOf Types of elements tracked by the matcher. + * @tparam NoneOf Types of elements used to filter out entities. * @return The updated collector. */ template @@ -84,7 +84,7 @@ struct basic_collector, type_list, Rule /** * @brief Adds an observing matcher to the collector. - * @tparam AnyOf Type of component for which changes should be detected. + * @tparam AnyOf Type of element for which changes should be detected. * @return The updated collector. */ template @@ -94,8 +94,8 @@ struct basic_collector, type_list, Rule /** * @brief Updates the filter of the last added matcher. - * @tparam AllOf Types of components required by the matcher. - * @tparam NoneOf Types of components used to filter out entities. + * @tparam AllOf Types of elements required by the matcher. + * @tparam NoneOf Types of elements used to filter out entities. * @return The updated collector. */ template @@ -114,13 +114,13 @@ inline constexpr basic_collector<> collector{}; * An observer returns all the entities and only the entities that fit the * requirements of at least one matcher. Moreover, it's guaranteed that the * entity list is tightly packed in memory for fast iterations.
- * In general, observers don't stay true to the order of any set of components. + * In general, observers don't stay true to the order of any set of elements. * * Observers work mainly with two types of matchers, provided through a * collector: * * * Observing matcher: an observer will return at least all the living entities - * for which one or more of the given components have been updated and not yet + * for which one or more of the given elements have been updated and not yet * destroyed. * * Grouping matcher: an observer will return at least all the living entities * that would have entered the given group if it existed and that would have @@ -140,13 +140,13 @@ inline constexpr basic_collector<> collector{}; * * Iterators aren't invalidated if: * - * * New instances of the given components are created and assigned to entities. + * * New instances of the given elements are created and assigned to entities. * * The entity currently pointed is modified (as an example, if one of the - * given components is removed from the entity to which the iterator points). + * given elements is removed from the entity to which the iterator points). * * The entity currently pointed is destroyed. * - * In all the other cases, modifying the pools of the given components in any - * way invalidates all the iterators. + * In all the other cases, modifying the pools of the given elements in any way + * invalidates all the iterators. * * @warning * Lifetime of an observer doesn't necessarily have to overcome that of the diff --git a/src/entt/entity/registry.hpp b/src/entt/entity/registry.hpp index a70d39309..6e6b8018e 100644 --- a/src/entt/entity/registry.hpp +++ b/src/entt/entity/registry.hpp @@ -430,10 +430,10 @@ public: } /** - * @brief Returns the storage for a given component type. - * @tparam Type Type of component of which to return the storage. + * @brief Returns the storage for a given element type. + * @tparam Type Type of element of which to return the storage. * @param id Optional name used to map the storage within the registry. - * @return The storage for the given component type. + * @return The storage for the given element type. */ template storage_for_type &storage(const id_type id = type_hash::value()) { @@ -441,10 +441,10 @@ public: } /** - * @brief Returns the storage for a given component type, if any. - * @tparam Type Type of component of which to return the storage. + * @brief Returns the storage for a given element type, if any. + * @tparam Type Type of element of which to return the storage. * @param id Optional name used to map the storage within the registry. - * @return The storage for the given component type. + * @return The storage for the given element type. */ template const storage_for_type *storage(const id_type id = type_hash::value()) const { @@ -509,7 +509,7 @@ public: * @brief Destroys an entity and releases its identifier. * * @warning - * Adding or removing components to an entity that is being destroyed can + * Adding or removing elements to an entity that is being destroyed can * result in undefined behavior. * * @param entt A valid identifier. @@ -564,19 +564,19 @@ public: } /** - * @brief Assigns the given component to an entity. + * @brief Assigns the given element to an entity. * - * The component must have a proper constructor or be of aggregate type. + * The element must have a proper constructor or be of aggregate type. * * @warning - * Attempting to assign a component to an entity that already owns it - * results in undefined behavior. + * Attempting to assign an element to an entity that already owns it results + * in undefined behavior. * - * @tparam Type Type of component to create. - * @tparam Args Types of arguments to use to construct the component. + * @tparam Type Type of element to create. + * @tparam Args Types of arguments to use to construct the element. * @param entt A valid identifier. - * @param args Parameters to use to initialize the component. - * @return A reference to the newly created component. + * @param args Parameters to use to initialize the element. + * @return A reference to the newly created element. */ template decltype(auto) emplace(const entity_type entt, Args &&...args) { @@ -585,15 +585,15 @@ public: } /** - * @brief Assigns each entity in a range the given component. + * @brief Assigns each entity in a range the given element. * * @sa emplace * - * @tparam Type Type of component to create. + * @tparam Type Type of element to create. * @tparam It Type of input iterator. * @param first An iterator to the first element of the range of entities. * @param last An iterator past the last element of the range of entities. - * @param value An instance of the component to assign. + * @param value An instance of the element to assign. */ template void insert(It first, It last, const Type &value = {}) { @@ -602,16 +602,16 @@ public: } /** - * @brief Assigns each entity in a range the given components. + * @brief Assigns each entity in a range the given elements. * * @sa emplace * - * @tparam Type Type of component to create. + * @tparam Type Type of element to create. * @tparam EIt Type of input iterator. * @tparam CIt Type of input iterator. * @param first An iterator to the first element of the range of entities. * @param last An iterator past the last element of the range of entities. - * @param from An iterator to the first element of the range of components. + * @param from An iterator to the first element of the range of elements. */ template::value_type, Type>>> void insert(EIt first, EIt last, CIt from) { @@ -620,16 +620,16 @@ public: } /** - * @brief Assigns or replaces the given component for an entity. + * @brief Assigns or replaces the given element for an entity. * * @sa emplace * @sa replace * - * @tparam Type Type of component to assign or replace. - * @tparam Args Types of arguments to use to construct the component. + * @tparam Type Type of element to assign or replace. + * @tparam Args Types of arguments to use to construct the element. * @param entt A valid identifier. - * @param args Parameters to use to initialize the component. - * @return A reference to the newly created component. + * @param args Parameters to use to initialize the element. + * @return A reference to the newly created element. */ template decltype(auto) emplace_or_replace(const entity_type entt, Args &&...args) { @@ -642,7 +642,7 @@ public: } /** - * @brief Patches the given component for an entity. + * @brief Patches the given element for an entity. * * The signature of the function should be equivalent to the following: * @@ -651,14 +651,14 @@ public: * @endcode * * @warning - * Attempting to patch a component of an entity that doesn't own it - * results in undefined behavior. + * Attempting to patch an element of an entity that doesn't own it results + * in undefined behavior. * - * @tparam Type Type of component to patch. + * @tparam Type Type of element to patch. * @tparam Func Types of the function objects to invoke. * @param entt A valid identifier. * @param func Valid function objects. - * @return A reference to the patched component. + * @return A reference to the patched element. */ template decltype(auto) patch(const entity_type entt, Func &&...func) { @@ -666,19 +666,19 @@ public: } /** - * @brief Replaces the given component for an entity. + * @brief Replaces the given element for an entity. * - * The component must have a proper constructor or be of aggregate type. + * The element must have a proper constructor or be of aggregate type. * * @warning - * Attempting to replace a component of an entity that doesn't own it - * results in undefined behavior. + * Attempting to replace an element of an entity that doesn't own it results + * in undefined behavior. * - * @tparam Type Type of component to replace. - * @tparam Args Types of arguments to use to construct the component. + * @tparam Type Type of element to replace. + * @tparam Args Types of arguments to use to construct the element. * @param entt A valid identifier. - * @param args Parameters to use to initialize the component. - * @return A reference to the component being replaced. + * @param args Parameters to use to initialize the element. + * @return A reference to the element being replaced. */ template decltype(auto) replace(const entity_type entt, Args &&...args) { @@ -686,11 +686,11 @@ public: } /** - * @brief Removes the given components from an entity. - * @tparam Type Type of component to remove. - * @tparam Other Other types of components to remove. + * @brief Removes the given elements from an entity. + * @tparam Type Type of element to remove. + * @tparam Other Other types of elements to remove. * @param entt A valid identifier. - * @return The number of components actually removed. + * @return The number of elements actually removed. */ template size_type remove(const entity_type entt) { @@ -698,16 +698,16 @@ public: } /** - * @brief Removes the given components from all the entities in a range. + * @brief Removes the given elements from all the entities in a range. * * @sa remove * - * @tparam Type Type of component to remove. - * @tparam Other Other types of components to remove. + * @tparam Type Type of element to remove. + * @tparam Other Other types of elements to remove. * @tparam It Type of input iterator. * @param first An iterator to the first element of the range of entities. * @param last An iterator past the last element of the range of entities. - * @return The number of components actually removed. + * @return The number of elements actually removed. */ template size_type remove(It first, It last) { @@ -735,14 +735,14 @@ public: } /** - * @brief Erases the given components from an entity. + * @brief Erases the given elements from an entity. * * @warning - * Attempting to erase a component from an entity that doesn't own it - * results in undefined behavior. + * Attempting to erase an element from an entity that doesn't own it results + * in undefined behavior. * - * @tparam Type Types of components to erase. - * @tparam Other Other types of components to erase. + * @tparam Type Types of elements to erase. + * @tparam Other Other types of elements to erase. * @param entt A valid identifier. */ template @@ -751,12 +751,12 @@ public: } /** - * @brief Erases the given components from all the entities in a range. + * @brief Erases the given elements from all the entities in a range. * * @sa erase * - * @tparam Type Types of components to erase. - * @tparam Other Other types of components to erase. + * @tparam Type Types of elements to erase. + * @tparam Other Other types of elements to erase. * @tparam It Type of input iterator. * @param first An iterator to the first element of the range of entities. * @param last An iterator past the last element of the range of entities. @@ -783,7 +783,7 @@ public: } /** - * @brief Erases components satisfying specific criteria from an entity. + * @brief Erases elements satisfying specific criteria from an entity. * * The function type is equivalent to: * @@ -808,8 +808,8 @@ public: /** * @brief Removes all tombstones from a registry or only the pools for the - * given components. - * @tparam Type Types of components for which to clear all tombstones. + * given elements. + * @tparam Type Types of elements for which to clear all tombstones. */ template void compact() { @@ -851,15 +851,15 @@ public: } /** - * @brief Returns references to the given components for an entity. + * @brief Returns references to the given elements for an entity. * * @warning - * Attempting to get a component from an entity that doesn't own it results + * Attempting to get an element from an entity that doesn't own it results * in undefined behavior. * - * @tparam Type Types of components to get. + * @tparam Type Types of elements to get. * @param entt A valid identifier. - * @return References to the components owned by the entity. + * @return References to the elements owned by the entity. */ template [[nodiscard]] decltype(auto) get([[maybe_unused]] const entity_type entt) const { @@ -881,19 +881,19 @@ public: } /** - * @brief Returns a reference to the given component for an entity. + * @brief Returns a reference to the given element for an entity. * - * In case the entity doesn't own the component, the parameters provided are + * In case the entity doesn't own the element, the parameters provided are * used to construct it. * * @sa get * @sa emplace * - * @tparam Type Type of component to get. - * @tparam Args Types of arguments to use to construct the component. + * @tparam Type Type of element to get. + * @tparam Args Types of arguments to use to construct the element. * @param entt A valid identifier. - * @param args Parameters to use to initialize the component. - * @return Reference to the component owned by the entity. + * @param args Parameters to use to initialize the element. + * @return Reference to the element owned by the entity. */ template [[nodiscard]] decltype(auto) get_or_emplace(const entity_type entt, Args &&...args) { @@ -906,14 +906,14 @@ public: } /** - * @brief Returns pointers to the given components for an entity. + * @brief Returns pointers to the given elements for an entity. * * @note - * The registry retains ownership of the pointed-to components. + * The registry retains ownership of the pointed-to elements. * - * @tparam Type Types of components to get. + * @tparam Type Types of elements to get. * @param entt A valid identifier. - * @return Pointers to the components owned by the entity. + * @return Pointers to the elements owned by the entity. */ template [[nodiscard]] auto try_get([[maybe_unused]] const entity_type entt) const { @@ -936,8 +936,8 @@ public: } /** - * @brief Clears a whole registry or the pools for the given components. - * @tparam Type Types of components to remove from their entities. + * @brief Clears a whole registry or the pools for the given elements. + * @tparam Type Types of elements to remove from their entities. */ template void clear() { @@ -954,30 +954,30 @@ public: } /** - * @brief Checks if an entity has components assigned. + * @brief Checks if an entity has elements assigned. * @param entt A valid identifier. - * @return True if the entity has no components assigned, false otherwise. + * @return True if the entity has no elements assigned, false otherwise. */ [[nodiscard]] bool orphan(const entity_type entt) const { return std::none_of(pools.cbegin(), pools.cend(), [entt](auto &&curr) { return curr.second->contains(entt); }); } /** - * @brief Returns a sink object for the given component. + * @brief Returns a sink object for the given element. * * Use this function to receive notifications whenever a new instance of the - * given component is created and assigned to an entity.
+ * given element is created and assigned to an entity.
* The function type for a listener is equivalent to: * * @code{.cpp} * void(basic_registry &, Entity); * @endcode * - * Listeners are invoked **after** assigning the component to the entity. + * Listeners are invoked **after** assigning the element to the entity. * * @sa sink * - * @tparam Type Type of component of which to get the sink. + * @tparam Type Type of element of which to get the sink. * @param id Optional name used to map the storage within the registry. * @return A temporary sink object. */ @@ -987,21 +987,21 @@ public: } /** - * @brief Returns a sink object for the given component. + * @brief Returns a sink object for the given element. * * Use this function to receive notifications whenever an instance of the - * given component is explicitly updated.
+ * given element is explicitly updated.
* The function type for a listener is equivalent to: * * @code{.cpp} * void(basic_registry &, Entity); * @endcode * - * Listeners are invoked **after** updating the component. + * Listeners are invoked **after** updating the element. * * @sa sink * - * @tparam Type Type of component of which to get the sink. + * @tparam Type Type of element of which to get the sink. * @param id Optional name used to map the storage within the registry. * @return A temporary sink object. */ @@ -1011,21 +1011,21 @@ public: } /** - * @brief Returns a sink object for the given component. + * @brief Returns a sink object for the given element. * * Use this function to receive notifications whenever an instance of the - * given component is removed from an entity and thus destroyed.
+ * given element is removed from an entity and thus destroyed.
* The function type for a listener is equivalent to: * * @code{.cpp} * void(basic_registry &, Entity); * @endcode * - * Listeners are invoked **before** removing the component from the entity. + * Listeners are invoked **before** removing the element from the entity. * * @sa sink * - * @tparam Type Type of component of which to get the sink. + * @tparam Type Type of element of which to get the sink. * @param id Optional name used to map the storage within the registry. * @return A temporary sink object. */ @@ -1035,10 +1035,10 @@ public: } /** - * @brief Returns a view for the given components. - * @tparam Type Type of component used to construct the view. - * @tparam Other Other types of components used to construct the view. - * @tparam Exclude Types of components used to filter the view. + * @brief Returns a view for the given elements. + * @tparam Type Type of element used to construct the view. + * @tparam Other Other types of elements used to construct the view. + * @tparam Exclude Types of elements used to filter the view. * @return A newly created view. */ template @@ -1058,7 +1058,7 @@ public: } /** - * @brief Returns a group for the given components. + * @brief Returns a group for the given elements. * @tparam Owned Types of storage _owned_ by the group. * @tparam Get Types of storage _observed_ by the group, if any. * @tparam Exclude Types of storage used to filter the group, if any. @@ -1101,10 +1101,10 @@ public: } /** - * @brief Checks whether the given components belong to any group. - * @tparam Type Type of component in which one is interested. - * @tparam Other Other types of components in which one is interested. - * @return True if the pools of the given components are _free_, false + * @brief Checks whether the given elements belong to any group. + * @tparam Type Type of element in which one is interested. + * @tparam Other Other types of elements in which one is interested. + * @return True if the pools of the given elements are _free_, false * otherwise. */ template @@ -1114,7 +1114,7 @@ public: } /** - * @brief Sorts the elements of a given component. + * @brief Sorts the elements of a given element. * * The comparison function object returns `true` if the first element is * _less_ than the second one, `false` otherwise. Its signature is also @@ -1136,9 +1136,9 @@ public: * passed along with the other parameters to this member function. * * @warning - * Pools of components owned by a group cannot be sorted. + * Pools of elements owned by a group cannot be sorted. * - * @tparam Type Type of components to sort. + * @tparam Type Type of elements to sort. * @tparam Compare Type of comparison function object. * @tparam Sort Type of sort function object. * @tparam Args Types of arguments to forward to the sort function object. @@ -1160,17 +1160,17 @@ public: } /** - * @brief Sorts two pools of components in the same way. + * @brief Sorts two pools of elements in the same way. * - * Entities and components in `To` which are part of both storage are sorted + * Entities and elements in `To` which are part of both storage are sorted * internally with the order they have in `From`. The others follow in no * particular order. * * @warning - * Pools of components owned by a group cannot be sorted. + * Pools of elements owned by a group cannot be sorted. * - * @tparam To Type of components to sort. - * @tparam From Type of components to use to sort. + * @tparam To Type of elements to sort. + * @tparam From Type of elements to use to sort. */ template void sort() { diff --git a/src/entt/entity/runtime_view.hpp b/src/entt/entity/runtime_view.hpp index 7a3016715..cc5c21ef4 100644 --- a/src/entt/entity/runtime_view.hpp +++ b/src/entt/entity/runtime_view.hpp @@ -98,15 +98,15 @@ private: * * Runtime views iterate over those entities that are at least in the given * storage. During initialization, a runtime view looks at the number of - * entities available for each component and uses the smallest set in order to - * get a performance boost when iterating. + * entities available for each element and uses the smallest set in order to get + * a performance boost when iterating. * * @b Important * * Iterators aren't invalidated if: * * * New elements are added to the storage. - * * The entity currently pointed is modified (for example, components are added + * * The entity currently pointed is modified (for example, elements are added * or removed from it). * * The entity currently pointed is destroyed. * @@ -241,11 +241,11 @@ public: /** * @brief Returns an iterator to the first entity that has the given - * components. + * elements. * * If the view is empty, the returned iterator will be equal to `end()`. * - * @return An iterator to the first entity that has the given components. + * @return An iterator to the first entity that has the given elements. */ [[nodiscard]] iterator begin() const { return pools.empty() ? iterator{} : iterator{pools, filter, pools[0]->begin()}; @@ -253,9 +253,9 @@ public: /** * @brief Returns an iterator that is past the last entity that has the - * given components. + * given elements. * @return An iterator to the entity following the last entity that has the - * given components. + * given elements. */ [[nodiscard]] iterator end() const { return pools.empty() ? iterator{} : iterator{pools, filter, pools[0]->end()}; diff --git a/src/entt/entity/snapshot.hpp b/src/entt/entity/snapshot.hpp index 3d7695ef0..ef4dcb667 100644 --- a/src/entt/entity/snapshot.hpp +++ b/src/entt/entity/snapshot.hpp @@ -37,7 +37,7 @@ void orphans(Registry ®istry) { * @brief Utility class to create snapshots from a registry. * * A _snapshot_ can be either a dump of the entire registry or a narrower - * selection of components of interest.
+ * selection of elements of interest.
* This type can be used in both cases if provided with a correctly configured * output archive. * @@ -224,10 +224,10 @@ public: } /** - * @brief Destroys those entities that have no components. + * @brief Destroys those entities that have no elements. * - * In case all the entities were serialized but only part of the components - * was saved, it could happen that some of the entities have no components + * In case all the entities were serialized but only part of the elements + * was saved, it could happen that some of the entities have no elements * once restored.
* This function helps to identify and destroy those entities. * @@ -406,10 +406,10 @@ public: } /** - * @brief Destroys those entities that have no components. + * @brief Destroys those entities that have no elements. * - * In case all the entities were serialized but only part of the components - * was saved, it could happen that some of the entities have no components + * In case all the entities were serialized but only part of the elements + * was saved, it could happen that some of the entities have no elements * once restored.
* This function helps to identify and destroy those entities. * diff --git a/src/entt/entity/storage.hpp b/src/entt/entity/storage.hpp index 0492b1e81..5328a8455 100644 --- a/src/entt/entity/storage.hpp +++ b/src/entt/entity/storage.hpp @@ -223,7 +223,7 @@ template * Empty types aren't explicitly instantiated. Therefore, many of the functions * normally available for non-empty types will not be available for empty ones. * - * @tparam Type Type of objects assigned to the entities. + * @tparam Type Element type. * @tparam Entity A valid entity type. * @tparam Allocator Type of allocator used to manage memory and elements. */ @@ -737,7 +737,7 @@ public: * @brief Returns an iterable object to use to _visit_ a storage. * * The iterable object returns a tuple that contains the current entity and - * a reference to its component. + * a reference to its element. * * @return An iterable object to use to _visit_ the storage. */ diff --git a/src/entt/entity/view.hpp b/src/entt/entity/view.hpp index 17c546cdf..7943f1eae 100644 --- a/src/entt/entity/view.hpp +++ b/src/entt/entity/view.hpp @@ -193,8 +193,8 @@ template * View iterators aren't invalidated if: * * * New elements are added to the storage iterated by the view. - * * The entity currently returned is modified (for example, components are - * added or removed from it). + * * The entity currently returned is modified (for example, elements are added + * or removed from it). * * The entity currently returned is destroyed. * * In all other cases, modifying the storage iterated by a view in any way can @@ -447,8 +447,8 @@ public: : basic_view{std::make_from_tuple(std::tuple_cat(value, excl))} {} /** - * @brief Forces a view to use a given component to drive iterations - * @tparam Type Type of component to use to drive iterations. + * @brief Forces a view to use a given element to drive iterations + * @tparam Type Type of element to use to drive iterations. */ template void use() noexcept { @@ -456,8 +456,8 @@ public: } /** - * @brief Forces a view to use a given component to drive iterations - * @tparam Index Index of the component to use to drive iterations. + * @brief Forces a view to use a given element to drive iterations + * @tparam Index Index of the element to use to drive iterations. */ template void use() noexcept { @@ -465,9 +465,9 @@ public: } /** - * @brief Returns the storage for a given component type, if any. - * @tparam Type Type of component of which to return the storage. - * @return The storage for the given component type. + * @brief Returns the storage for a given element type, if any. + * @tparam Type Type of element of which to return the storage. + * @return The storage for the given element type. */ template [[nodiscard]] auto *storage() const noexcept { @@ -519,20 +519,20 @@ public: } /** - * @brief Returns the components assigned to the given entity. + * @brief Returns the elements assigned to the given entity. * @param entt A valid identifier. - * @return The components assigned to the given entity. + * @return The elements assigned to the given entity. */ [[nodiscard]] decltype(auto) operator[](const entity_type entt) const { return get(entt); } /** - * @brief Returns the components assigned to the given entity. - * @tparam Type Type of the component to get. - * @tparam Other Other types of components to get. + * @brief Returns the elements assigned to the given entity. + * @tparam Type Type of the element to get. + * @tparam Other Other types of elements to get. * @param entt A valid identifier. - * @return The components assigned to the entity. + * @return The elements assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -540,10 +540,10 @@ public: } /** - * @brief Returns the components assigned to the given entity. - * @tparam Index Indexes of the components to get. + * @brief Returns the elements assigned to the given entity. + * @tparam Index Indexes of the elements to get. * @param entt A valid identifier. - * @return The components assigned to the entity. + * @return The elements assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -557,7 +557,7 @@ public: } /** - * @brief Iterates entities and components and applies the given function + * @brief Iterates entities and elements and applies the given function * object to them. * * The signature of the function must be equivalent to one of the following @@ -582,8 +582,8 @@ public: * @brief Returns an iterable object to use to _visit_ a view. * * The iterable object returns a tuple that contains the current entity and - * a set of references to its non-empty components. The _constness_ of the - * components is as requested. + * a set of references to its non-empty elements. The _constness_ of the + * elements is as requested. * * @return An iterable object to use to _visit_ the view. */ @@ -593,7 +593,7 @@ public: /** * @brief Combines two views in a _more specific_ one. - * @tparam OGet Component list of the view to combine with. + * @tparam OGet Element list of the view to combine with. * @tparam OExclude Filter list of the view to combine with. * @param other The view to combine with. * @return A more specific view. @@ -641,8 +641,8 @@ public: } /** - * @brief Returns the number of entities that have the given component. - * @return Number of entities that have the given component. + * @brief Returns the number of entities that have the given element. + * @return Number of entities that have the given element. */ [[nodiscard]] size_type size() const noexcept { return leading ? leading->size() : size_type{}; @@ -795,13 +795,13 @@ public: : basic_view{std::get<0>(value)} {} /** - * @brief Returns the storage for a given component type, if any. - * @tparam Type Type of component of which to return the storage. - * @return The storage for the given component type. + * @brief Returns the storage for a given element type, if any. + * @tparam Type Type of element of which to return the storage. + * @return The storage for the given element type. */ template [[nodiscard]] auto *storage() const noexcept { - static_assert(std::is_same_v, typename Get::element_type>, "Invalid component type"); + static_assert(std::is_same_v, typename Get::element_type>, "Invalid element type"); return storage<0>(); } @@ -836,31 +836,31 @@ public: } /** - * @brief Returns the component assigned to the given entity. + * @brief Returns the element assigned to the given entity. * @param entt A valid identifier. - * @return The component assigned to the given entity. + * @return The element assigned to the given entity. */ [[nodiscard]] decltype(auto) operator[](const entity_type entt) const { return storage()->get(entt); } /** - * @brief Returns the component assigned to the given entity. - * @tparam Elem Type of the component to get. + * @brief Returns the element assigned to the given entity. + * @tparam Elem Type of the element to get. * @param entt A valid identifier. - * @return The component assigned to the entity. + * @return The element assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { - static_assert(std::is_same_v, typename Get::element_type>, "Invalid component type"); + static_assert(std::is_same_v, typename Get::element_type>, "Invalid element type"); return get<0>(entt); } /** - * @brief Returns the component assigned to the given entity. - * @tparam Index Index of the component to get. + * @brief Returns the element assigned to the given entity. + * @tparam Index Index of the element to get. * @param entt A valid identifier. - * @return The component assigned to the entity. + * @return The element assigned to the entity. */ template [[nodiscard]] decltype(auto) get(const entity_type entt) const { @@ -872,7 +872,7 @@ public: } /** - * @brief Iterates entities and components and applies the given function + * @brief Iterates entities and elements and applies the given function * object to them. * * The signature of the function must be equivalent to one of the following @@ -894,8 +894,8 @@ public: std::apply(func, pack); } } else if constexpr(std::is_invocable_vbegin())>) { - for(auto &&component: *elem) { - func(component); + for(auto &&curr: *elem) { + func(curr); } } else { for(size_type pos = elem->size(); pos; --pos) { @@ -909,8 +909,8 @@ public: * @brief Returns an iterable object to use to _visit_ a view. * * The iterable object returns a tuple that contains the current entity and - * a reference to its component if it's a non-empty one. The _constness_ of - * the component is as requested. + * a reference to its element if it's a non-empty one. The _constness_ of + * the element is as requested. * * @return An iterable object to use to _visit_ the view. */ @@ -921,7 +921,7 @@ public: /** * @brief Combines two views in a _more specific_ one. - * @tparam OGet Component list of the view to combine with. + * @tparam OGet Element list of the view to combine with. * @tparam OExclude Filter list of the view to combine with. * @param other The view to combine with. * @return A more specific view. @@ -943,8 +943,8 @@ basic_view(Type &...storage) -> basic_view, exclude_t<>>; /** * @brief Deduction guide. - * @tparam Get Types of components iterated by the view. - * @tparam Exclude Types of components used to filter the view. + * @tparam Get Types of elements iterated by the view. + * @tparam Exclude Types of elements used to filter the view. */ template basic_view(std::tuple, std::tuple = {}) -> basic_view, exclude_t>; diff --git a/test/entt/entity/storage.cpp b/test/entt/entity/storage.cpp index 47008c908..acf380af0 100644 --- a/test/entt/entity/storage.cpp +++ b/test/entt/entity/storage.cpp @@ -1568,14 +1568,14 @@ TEST(Storage, MoveOnlyComponent) { using value_type = std::unique_ptr; static_assert(!std::is_copy_assignable_v, "Copy assignable types not allowed"); static_assert(std::is_move_assignable_v, "Move assignable type required"); - // the purpose is to ensure that move only components are always accepted + // the purpose is to ensure that move only types are always accepted [[maybe_unused]] const entt::storage pool; } TEST(Storage, NonMovableComponent) { using value_type = std::pair; static_assert(!std::is_move_assignable_v, "Move assignable types not allowed"); - // the purpose is to ensure that non-movable components are always accepted + // the purpose is to ensure that non-movable types are always accepted [[maybe_unused]] const entt::storage pool; } diff --git a/test/example/signal_less.cpp b/test/example/signal_less.cpp index 361467306..45e13b2fe 100644 --- a/test/example/signal_less.cpp +++ b/test/example/signal_less.cpp @@ -7,7 +7,7 @@ template struct entt::storage_type { - // no signal regardless of component type ... + // no signal regardless of element type ... using type = basic_storage; }; diff --git a/test/lib/registry/plugin/plugin.cpp b/test/lib/registry/plugin/plugin.cpp index 30fb9d44e..fb9ea149d 100644 --- a/test/lib/registry/plugin/plugin.cpp +++ b/test/lib/registry/plugin/plugin.cpp @@ -11,7 +11,7 @@ CR_EXPORT int cr_main(cr_plugin *ctx, cr_op operation) { // forces things to break auto ®istry = *static_cast(ctx->userdata); - // forces the creation of the pool for the empty component + // forces the creation of the pool for the empty type static_cast(registry.storage()); const auto view = registry.view();