summaryrefslogtreecommitdiff
path: root/domain/include
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2024-07-17 15:59:41 +0200
committerFelix Morgner <felix.morgner@gmail.com>2024-07-17 15:59:41 +0200
commit79c06fc454b91bc14b4a85dd6ec0c870c8ab6da8 (patch)
treebe40741f637981b1e07b620c77cb2b34c67fc8c3 /domain/include
parent631a8065aa9753c27f84c08bee49334c1b473bdc (diff)
downloadturns-79c06fc454b91bc14b4a85dd6ec0c870c8ab6da8.tar.xz
turns-79c06fc454b91bc14b4a85dd6ec0c870c8ab6da8.zip
domain/tests: improve turn_order tests
Diffstat (limited to 'domain/include')
-rw-r--r--domain/include/turns/domain/turn_order.hpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/domain/include/turns/domain/turn_order.hpp b/domain/include/turns/domain/turn_order.hpp
index 59438d6..3b42562 100644
--- a/domain/include/turns/domain/turn_order.hpp
+++ b/domain/include/turns/domain/turn_order.hpp
@@ -4,6 +4,8 @@
#include "turns/domain/disposition.hpp"
#include "turns/domain/participant.hpp"
+#include <limits>
+
#include <giomm/liststore.h>
#include <glibmm/property.h>
#include <glibmm/refptr.h>
@@ -21,6 +23,8 @@ namespace turns::domain
using running_type = bool;
using round_type = unsigned int;
+ auto static constexpr invalid_participant_index = std::numeric_limits<active_participant_type>::max();
+
auto static create() -> Glib::RefPtr<turn_order>;
turn_order();
@@ -38,12 +42,43 @@ namespace turns::domain
/** Querries */
+ /**
+ * Get the index of the currently active participant of this turn order, if any.
+ *
+ * @returns an unsigned integer in the range [0, size()) if there is an active participant, or turn_order::invalid_participant_index otherwise.
+ */
auto active_participant() const noexcept -> active_participant_type;
+
+ /**
+ * Check if this turn order is empty.
+ */
auto empty() const noexcept -> empty_type;
+
+ /**
+ * Get the actor at the specified position in this turn order.
+ *
+ * @return a valid pointer to a participant object if the index was valid, nullptr otherwise.
+ */
auto get(unsigned int index) const noexcept -> Glib::RefPtr<participant>;
+
+ /**
+ * Get the underlying list model, to be used with list views.
+ */
auto list_model() -> Glib::RefPtr<Gio::ListModel>;
+
+ /**
+ * Get the current round.
+ */
auto round() const noexcept -> round_type;
+
+ /**
+ * Check if this turn order is currently running.
+ */
auto running() const noexcept -> running_type;
+
+ /**
+ * Get the size of this turn order
+ */
auto size() const noexcept -> unsigned int;
/** Properties */