diff --git a/flecs.h b/flecs.h index 74534dc2fe..bf878e0bb0 100644 --- a/flecs.h +++ b/flecs.h @@ -19785,6 +19785,7 @@ struct world { flecs::entity set_scope() const; /** Set search path. + * @see ecs_set_lookup_path */ flecs::entity_t* set_lookup_path(const flecs::entity_t *search_path) const { return ecs_set_lookup_path(m_world, search_path); @@ -19948,7 +19949,7 @@ struct world { template void remove() const; - /** Adds a pair to the singleton component. + /** Removes the pair singleton component. * * @tparam First The first element of the pair * @tparam Second The second element of the pair @@ -19956,7 +19957,7 @@ struct world { template void remove() const; - /** Adds a pair to the singleton component. + /** Removes the pair singleton component. * * @tparam First The first element of the pair * @param second The second element of the pair. @@ -19964,7 +19965,7 @@ struct world { template void remove(flecs::entity_t second) const; - /** Adds a pair to the singleton entity. + /** Removes the pair singleton component. * * @param first The first element of the pair * @param second The second element of the pair @@ -22384,6 +22385,23 @@ struct entity_builder : entity_view { return to_base(); } + /** Add pair for enum constant. + * This operation will add a pair to the entity where the first element is + * the enumeration type, and the second element the enumeration constant. + * + * The operation may be used with regular (C style) enumerations as well as + * enum classes. + * + * @param value The enumeration value. + */ + template ::value > = 0> + Self& add(E value) { + flecs::entity_t first = _::cpp_type::id(this->m_world); + const auto& et = enum_type(this->m_world); + flecs::entity_t second = et.entity(value); + return this->add(first, second); + } + /** Add an entity to an entity. * Add an entity to the entity. This is typically used for tagging. * @@ -22630,6 +22648,17 @@ struct entity_builder : entity_view { return to_base(); } + /** Remove pair for enum. + * This operation will remove any (Enum, *) pair from the entity. + * + * @tparam E The enumeration type. + */ + template ::value > = 0> + Self& remove() { + flecs::entity_t first = _::cpp_type::id(this->m_world); + return this->remove(first, flecs::Wildcard); + } + /** Remove an entity from an entity. * * @param entity The entity to remove. @@ -22662,7 +22691,7 @@ struct entity_builder : entity_view { } /** Remove a pair. - * This operation adds a pair to the entity. + * This operation removes the pair from the entity. * * @tparam First The first element of the pair * @param second The second element of the pair. @@ -22684,7 +22713,7 @@ struct entity_builder : entity_view { } /** Remove a pair. - * This operation adds a pair to the entity. + * This operation removes the pair from the entity. * * @tparam First The first element of the pair * @param constant the enum constant. @@ -22856,34 +22885,6 @@ struct entity_builder : entity_view { return to_base(); } - /** Add pair for enum constant. - * This operation will add a pair to the entity where the first element is - * the enumeration type, and the second element the enumeration constant. - * - * The operation may be used with regular (C style) enumerations as well as - * enum classes. - * - * @param value The enumeration value. - */ - template ::value > = 0> - Self& add(E value) { - flecs::entity_t first = _::cpp_type::id(this->m_world); - const auto& et = enum_type(this->m_world); - flecs::entity_t second = et.entity(value); - return this->add(first, second); - } - - /** Remove pair for enum. - * This operation will remove any (Enum, *) pair from the entity. - * - * @tparam E The enumeration type. - */ - template ::value > = 0> - Self& remove() { - flecs::entity_t first = _::cpp_type::id(this->m_world); - return this->remove(first, flecs::Wildcard); - } - /** Enable an entity. * Enabled entities are matched with systems and can be searched with * queries. @@ -23236,6 +23237,7 @@ struct entity_builder : entity_view { } /** Entities created in function will have the current entity. + * This operation is thread safe. * * @param func The function to call. */ @@ -23260,6 +23262,7 @@ struct entity_builder : entity_view { } /** Entities created in function will have (first, this). + * This operation is thread safe. * * @param first The first element of the pair. * @param func The function to call. @@ -23578,7 +23581,7 @@ struct entity : entity_builder _::cpp_type::id(m_world)))); } - /** Get mutable pointer for a pair. + /** Get mutable pointer for the first element of a pair. * This operation gets the value for a pair from the entity. * * @tparam First The first part of the pair. diff --git a/include/flecs/addons/cpp/entity.hpp b/include/flecs/addons/cpp/entity.hpp index 0757e9935c..6ddffd0281 100644 --- a/include/flecs/addons/cpp/entity.hpp +++ b/include/flecs/addons/cpp/entity.hpp @@ -122,7 +122,7 @@ struct entity : entity_builder _::cpp_type::id(m_world)))); } - /** Get mutable pointer for a pair. + /** Get mutable pointer for the first element of a pair. * This operation gets the value for a pair from the entity. * * @tparam First The first part of the pair. diff --git a/include/flecs/addons/cpp/mixins/entity/builder.hpp b/include/flecs/addons/cpp/mixins/entity/builder.hpp index 31963b563c..49ba17ca0c 100644 --- a/include/flecs/addons/cpp/mixins/entity/builder.hpp +++ b/include/flecs/addons/cpp/mixins/entity/builder.hpp @@ -29,6 +29,23 @@ struct entity_builder : entity_view { return to_base(); } + /** Add pair for enum constant. + * This operation will add a pair to the entity where the first element is + * the enumeration type, and the second element the enumeration constant. + * + * The operation may be used with regular (C style) enumerations as well as + * enum classes. + * + * @param value The enumeration value. + */ + template ::value > = 0> + Self& add(E value) { + flecs::entity_t first = _::cpp_type::id(this->m_world); + const auto& et = enum_type(this->m_world); + flecs::entity_t second = et.entity(value); + return this->add(first, second); + } + /** Add an entity to an entity. * Add an entity to the entity. This is typically used for tagging. * @@ -275,6 +292,17 @@ struct entity_builder : entity_view { return to_base(); } + /** Remove pair for enum. + * This operation will remove any (Enum, *) pair from the entity. + * + * @tparam E The enumeration type. + */ + template ::value > = 0> + Self& remove() { + flecs::entity_t first = _::cpp_type::id(this->m_world); + return this->remove(first, flecs::Wildcard); + } + /** Remove an entity from an entity. * * @param entity The entity to remove. @@ -307,7 +335,7 @@ struct entity_builder : entity_view { } /** Remove a pair. - * This operation adds a pair to the entity. + * This operation removes the pair from the entity. * * @tparam First The first element of the pair * @param second The second element of the pair. @@ -329,7 +357,7 @@ struct entity_builder : entity_view { } /** Remove a pair. - * This operation adds a pair to the entity. + * This operation removes the pair from the entity. * * @tparam First The first element of the pair * @param constant the enum constant. @@ -501,34 +529,6 @@ struct entity_builder : entity_view { return to_base(); } - /** Add pair for enum constant. - * This operation will add a pair to the entity where the first element is - * the enumeration type, and the second element the enumeration constant. - * - * The operation may be used with regular (C style) enumerations as well as - * enum classes. - * - * @param value The enumeration value. - */ - template ::value > = 0> - Self& add(E value) { - flecs::entity_t first = _::cpp_type::id(this->m_world); - const auto& et = enum_type(this->m_world); - flecs::entity_t second = et.entity(value); - return this->add(first, second); - } - - /** Remove pair for enum. - * This operation will remove any (Enum, *) pair from the entity. - * - * @tparam E The enumeration type. - */ - template ::value > = 0> - Self& remove() { - flecs::entity_t first = _::cpp_type::id(this->m_world); - return this->remove(first, flecs::Wildcard); - } - /** Enable an entity. * Enabled entities are matched with systems and can be searched with * queries. @@ -881,6 +881,7 @@ struct entity_builder : entity_view { } /** Entities created in function will have the current entity. + * This operation is thread safe. * * @param func The function to call. */ @@ -905,6 +906,7 @@ struct entity_builder : entity_view { } /** Entities created in function will have (first, this). + * This operation is thread safe. * * @param first The first element of the pair. * @param func The function to call. diff --git a/include/flecs/addons/cpp/world.hpp b/include/flecs/addons/cpp/world.hpp index f7025d8425..9d8f9f5869 100644 --- a/include/flecs/addons/cpp/world.hpp +++ b/include/flecs/addons/cpp/world.hpp @@ -543,6 +543,7 @@ struct world { flecs::entity set_scope() const; /** Set search path. + * @see ecs_set_lookup_path */ flecs::entity_t* set_lookup_path(const flecs::entity_t *search_path) const { return ecs_set_lookup_path(m_world, search_path); @@ -706,7 +707,7 @@ struct world { template void remove() const; - /** Adds a pair to the singleton component. + /** Removes the pair singleton component. * * @tparam First The first element of the pair * @tparam Second The second element of the pair @@ -714,7 +715,7 @@ struct world { template void remove() const; - /** Adds a pair to the singleton component. + /** Removes the pair singleton component. * * @tparam First The first element of the pair * @param second The second element of the pair. @@ -722,7 +723,7 @@ struct world { template void remove(flecs::entity_t second) const; - /** Adds a pair to the singleton entity. + /** Removes the pair singleton component. * * @param first The first element of the pair * @param second The second element of the pair