Browse Source

process: make succeed and fail functions public

skypjack 9 months ago
parent
commit
8574335fe6
2 changed files with 20 additions and 29 deletions
  1. 20 21
      src/entt/process/process.hpp
  2. 0 8
      test/entt/process/process.cpp

+ 20 - 21
src/entt/process/process.hpp

@@ -113,27 +113,6 @@ class process {
     template<typename... Args>
     void next(Args...) const noexcept {}
 
-protected:
-    /**
-     * @brief Terminates a process with success if it's still alive, otherwise
-     * does nothing.
-     */
-    void succeed() noexcept {
-        if(alive()) {
-            current = state::succeeded;
-        }
-    }
-
-    /**
-     * @brief Terminates a process with errors if it's still alive, otherwise
-     * does nothing.
-     */
-    void fail() noexcept {
-        if(alive()) {
-            current = state::failed;
-        }
-    }
-
 public:
     /*! @brief Type used to provide elapsed time. */
     using delta_type = Delta;
@@ -178,6 +157,26 @@ public:
         }
     }
 
+    /**
+     * @brief Terminates a process with success if it's still alive, otherwise
+     * does nothing.
+     */
+    void succeed() noexcept {
+        if(alive()) {
+            current = state::succeeded;
+        }
+    }
+
+    /**
+     * @brief Terminates a process with errors if it's still alive, otherwise
+     * does nothing.
+     */
+    void fail() noexcept {
+        if(alive()) {
+            current = state::failed;
+        }
+    }
+
     /*! @brief Stops a process if it's running, otherwise does nothing. */
     void pause() noexcept {
         if(current == state::running) {

+ 0 - 8
test/entt/process/process.cpp

@@ -8,14 +8,6 @@ struct fake_process: entt::process<fake_process<Delta>, Delta> {
     using process_type = entt::process<fake_process<Delta>, Delta>;
     using delta_type = typename process_type::delta_type;
 
-    void succeed() noexcept {
-        process_type::succeed();
-    }
-
-    void fail() noexcept {
-        process_type::fail();
-    }
-
     void init() {
         init_invoked = true;
     }