summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2025-05-09 10:48:30 +0200
committerFelix Morgner <felix.morgner@gmail.com>2025-05-09 10:48:30 +0200
commit71fe1d395a3c1d94dac68469826118e357f7086d (patch)
tree5db04ceaf4bf80c3f9566b26236f3d6f17266be2 /core/src
parent87c6607602e969d94ed8b8f97bb45f416e37b22d (diff)
downloadturns-71fe1d395a3c1d94dac68469826118e357f7086d.tar.xz
turns-71fe1d395a3c1d94dac68469826118e357f7086d.zip
core: rename turn_order to TurnOderModel
Diffstat (limited to 'core/src')
-rw-r--r--core/src/init.cpp4
-rw-r--r--core/src/turn_order_model.cpp (renamed from core/src/turn_order.cpp)66
2 files changed, 35 insertions, 35 deletions
diff --git a/core/src/init.cpp b/core/src/init.cpp
index 3434f91..4f67817 100644
--- a/core/src/init.cpp
+++ b/core/src/init.cpp
@@ -2,7 +2,7 @@
#include "turns/core/disposition.hpp"
#include "turns/core/participant.hpp"
-#include "turns/core/turn_order.hpp"
+#include "turns/core/turn_order_model.hpp"
#include <glib-object.h>
@@ -12,7 +12,7 @@ namespace turns::core
auto register_types() -> void
{
static_cast<void>(Participant{});
- static_cast<void>(turn_order{});
+ static_cast<void>(TurnOderModel{});
g_type_ensure(Glib::Value<Disposition>::value_type());
}
diff --git a/core/src/turn_order.cpp b/core/src/turn_order_model.cpp
index 669f746..e430fed 100644
--- a/core/src/turn_order.cpp
+++ b/core/src/turn_order_model.cpp
@@ -1,4 +1,4 @@
-#include "turns/core/turn_order.hpp"
+#include "turns/core/turn_order_model.hpp"
#include "turns/core/disposition.hpp"
#include "turns/core/json_ext.hpp"
@@ -39,71 +39,71 @@ namespace turns::core
/** Construction */
- turn_order::turn_order()
- : Glib::ObjectBase{typeid(turn_order)}
+ TurnOderModel::TurnOderModel()
+ : Glib::ObjectBase{typeid(TurnOderModel)}
, Gio::ListModel{}
{
}
- turn_order::turn_order(nlohmann::json const & from)
- : turn_order{}
+ TurnOderModel::TurnOderModel(nlohmann::json const & from)
+ : TurnOderModel{}
{
load(from);
}
- auto turn_order::create() -> Glib::RefPtr<turn_order>
+ auto TurnOderModel::create() -> Glib::RefPtr<TurnOderModel>
{
- return Glib::make_refptr_for_instance(new turn_order{});
+ return Glib::make_refptr_for_instance(new TurnOderModel{});
}
- auto turn_order::create(nlohmann::json const & from) -> Glib::RefPtr<turn_order>
+ auto TurnOderModel::create(nlohmann::json const & from) -> Glib::RefPtr<TurnOderModel>
{
- return Glib::make_refptr_for_instance(new turn_order{from});
+ return Glib::make_refptr_for_instance(new TurnOderModel{from});
}
/** Queries */
- auto turn_order::is_empty() const -> Glib::PropertyProxy_ReadOnly<is_empty_type>
+ auto TurnOderModel::is_empty() const -> Glib::PropertyProxy_ReadOnly<is_empty_type>
{
return m_is_empty.get_proxy();
}
- auto turn_order::has_next() const -> Glib::PropertyProxy_ReadOnly<has_next_type>
+ auto TurnOderModel::has_next() const -> Glib::PropertyProxy_ReadOnly<has_next_type>
{
return m_has_next.get_proxy();
}
- auto turn_order::has_previous() const -> Glib::PropertyProxy_ReadOnly<has_previous_type>
+ auto TurnOderModel::has_previous() const -> Glib::PropertyProxy_ReadOnly<has_previous_type>
{
return m_has_previous.get_proxy();
}
- auto turn_order::is_running() const -> Glib::PropertyProxy_ReadOnly<is_running_type>
+ auto TurnOderModel::is_running() const -> Glib::PropertyProxy_ReadOnly<is_running_type>
{
return m_is_running.get_proxy();
}
- auto turn_order::progress() const -> Glib::PropertyProxy_ReadOnly<progress_type>
+ auto TurnOderModel::progress() const -> Glib::PropertyProxy_ReadOnly<progress_type>
{
return m_progress.get_proxy();
}
- auto turn_order::round_number() const -> Glib::PropertyProxy_ReadOnly<round_number_type>
+ auto TurnOderModel::round_number() const -> Glib::PropertyProxy_ReadOnly<round_number_type>
{
return m_round_number.get_proxy();
}
- auto turn_order::skip_defeated() -> Glib::PropertyProxy<skip_defeated_type>
+ auto TurnOderModel::skip_defeated() -> Glib::PropertyProxy<skip_defeated_type>
{
return m_skip_defeated.get_proxy();
}
/** Modifiers */
- auto turn_order::add(Glib::ustring const & name, float priority, Disposition disposition) -> void
+ auto TurnOderModel::add(Glib::ustring const & name, float priority, Disposition disposition) -> void
{
auto entry = Participant::create(name, priority, disposition);
- entry->property_priority().signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &turn_order::handle_priority_changed), entry));
+ entry->property_priority().signal_changed().connect(sigc::bind(sigc::mem_fun(*this, &TurnOderModel::handle_priority_changed), entry));
auto position = std::distance(m_data.cbegin(), insert(entry));
items_changed(position, 0, 1);
@@ -114,7 +114,7 @@ namespace turns::core
}
}
- auto turn_order::clear() -> void
+ auto TurnOderModel::clear() -> void
{
m_is_running = false;
m_is_empty = true;
@@ -129,7 +129,7 @@ namespace turns::core
items_changed(0, old_size, 0);
}
- auto turn_order::next() -> void
+ auto TurnOderModel::next() -> void
{
auto old_active = *m_active;
m_active = m_active.transform([this](auto index) { return (index + 1) % get_n_items(); });
@@ -146,7 +146,7 @@ namespace turns::core
}
}
- auto turn_order::previous() -> void
+ auto TurnOderModel::previous() -> void
{
if (!(m_has_previous && m_is_running))
{
@@ -168,7 +168,7 @@ namespace turns::core
}
}
- auto turn_order::remove(unsigned index) -> void
+ auto TurnOderModel::remove(unsigned index) -> void
{
if (index >= get_n_items())
{
@@ -186,7 +186,7 @@ namespace turns::core
}
}
- auto turn_order::start() -> void
+ auto TurnOderModel::start() -> void
{
if (!m_active)
{
@@ -202,14 +202,14 @@ namespace turns::core
m_progress = (static_cast<float>(*m_active) + 1) / get_n_items();
}
- auto turn_order::stop() -> void
+ auto TurnOderModel::stop() -> void
{
m_is_running = false;
m_progress = 0;
}
/** Serialization */
- auto turn_order::load(nlohmann::json const & from) -> void
+ auto TurnOderModel::load(nlohmann::json const & from) -> void
{
auto old_size = get_n_items();
@@ -222,7 +222,7 @@ namespace turns::core
auto factory = [](auto s) {
return Participant::create(s);
};
- auto inserter = std::bind(&turn_order::insert, this, _1);
+ auto inserter = std::bind(&TurnOderModel::insert, this, _1);
std::ranges::for_each(participants | std::views::transform(factory), inserter);
auto active = std::ranges::find_if(m_data, [](auto participant) { return participant->property_is_active(); });
@@ -240,7 +240,7 @@ namespace turns::core
items_changed(0, old_size, get_n_items());
}
- auto turn_order::serialize() -> nlohmann::json
+ auto TurnOderModel::serialize() -> nlohmann::json
{
auto serialized = nlohmann::json{};
if (m_round_number != invalid_round_number)
@@ -254,17 +254,17 @@ namespace turns::core
/** ListModel implementation */
- auto turn_order::get_item_type_vfunc() -> GType
+ auto TurnOderModel::get_item_type_vfunc() -> GType
{
return Participant::get_type();
}
- auto turn_order::get_n_items_vfunc() -> unsigned
+ auto TurnOderModel::get_n_items_vfunc() -> unsigned
{
return m_data.size();
}
- auto turn_order::get_item_vfunc(unsigned position) -> void *
+ auto TurnOderModel::get_item_vfunc(unsigned position) -> void *
{
if (position >= get_n_items())
{
@@ -277,7 +277,7 @@ namespace turns::core
/** Signal handlers */
- auto turn_order::handle_priority_changed(value_type entry) -> void
+ auto TurnOderModel::handle_priority_changed(value_type entry) -> void
{
auto original_position = find(entry);
auto original_index = distance(m_data.cbegin(), original_position);
@@ -299,12 +299,12 @@ namespace turns::core
/** Data management */
- auto turn_order::find(value_type entry) const -> const_iterator
+ auto TurnOderModel::find(value_type entry) const -> const_iterator
{
return std::ranges::find(m_data, entry);
}
- auto turn_order::insert(value_type entry) -> const_iterator
+ auto TurnOderModel::insert(value_type entry) -> const_iterator
{
return m_data.insert(std::ranges::upper_bound(m_data, entry, comparator), entry);
}