From e088f0f31ea5a55f71446e75b659017e8e123333 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Sun, 16 Jun 2019 15:16:04 +0200 Subject: [PATCH] observer: when -> where (close #265) --- docs/md/entity.md | 6 +++--- src/entt/entity/observer.hpp | 6 +++--- test/entt/entity/observer.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/md/entity.md b/docs/md/entity.md index 2a9311cfa..b581bac6c 100644 --- a/docs/md/entity.md +++ b/docs/md/entity.md @@ -512,10 +512,10 @@ last time one asked.
Note that, for a grouping matcher, if an entity already has all the components except one and the missing type is assigned to it, it is intercepted. -In addition, a matcher can be filtered with a `when` clause: +In addition, a matcher can be filtered with a `where` clause: ```cpp -entt::collector.replace().when(entt::exclude); +entt::collector.replace().where(entt::exclude); ``` This clause introduces a way to intercept entities if and only if they are @@ -526,7 +526,7 @@ the observer probes the entity itself to verify that it has at least `position` and has not `velocity` before to store it aside. If one of the two conditions of the filter isn't respected, the entity is discared, no matter what. -A `when` clause accepts a theoretically unlimited number of types as well as +A `where` clause accepts a theoretically unlimited number of types as well as multiple elements in the exclusion list. Moreover, every matcher can have it's own clause and multiple clauses for the same matcher are combined in a single one. diff --git a/src/entt/entity/observer.hpp b/src/entt/entity/observer.hpp index d6727cf14..b51d5b85d 100644 --- a/src/entt/entity/observer.hpp +++ b/src/entt/entity/observer.hpp @@ -104,7 +104,7 @@ struct basic_collector, type_list - static constexpr auto when(exclude_t = {}) ENTT_NOEXCEPT { + static constexpr auto where(exclude_t = {}) ENTT_NOEXCEPT { return basic_collector, type_list>, Rule...>, Other...>{}; } }; @@ -135,8 +135,8 @@ constexpr basic_collector<> collector{}; * If an entity respects the requirements of multiple matchers, it will be * returned once and only once by the observer in any case. * - * Matchers support also filtering by means of a _when_ clause that accepts both - * a list of types and an exclusion list.
+ * Matchers support also filtering by means of a _where_ clause that accepts + * both a list of types and an exclusion list.
* Whenever a matcher finds that an entity matches its requirements, the * condition of the filter is verified before to register the entity itself. * Moreover, a registered entity isn't returned by the observer if the condition diff --git a/test/entt/entity/observer.cpp b/test/entt/entity/observer.cpp index 1240623eb..9562552ed 100644 --- a/test/entt/entity/observer.cpp +++ b/test/entt/entity/observer.cpp @@ -86,7 +86,7 @@ TEST(Observer, AllOf) { TEST(Observer, AllOfFiltered) { constexpr auto collector = entt::collector - .group().when(entt::exclude); + .group().where(entt::exclude); entt::registry registry; entt::observer observer{registry, collector}; @@ -160,7 +160,7 @@ TEST(Observer, Observe) { TEST(Observer, ObserveFiltered) { constexpr auto collector = entt::collector - .replace().when(entt::exclude); + .replace().where(entt::exclude); entt::registry registry; entt::observer observer{registry, collector};