diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-07-24 10:44:13 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-07-24 10:44:13 +0200 |
| commit | 3f5499cebc06356ed99159be3fb9676292cf7b8b (patch) | |
| tree | 63d36c3cd33de5746b8e3a29922e6ab7a6578def /domain/include | |
| parent | 0d61f98434b95c754f46c918af5152eda82077cb (diff) | |
| download | turns-3f5499cebc06356ed99159be3fb9676292cf7b8b.tar.xz turns-3f5499cebc06356ed99159be3fb9676292cf7b8b.zip | |
turns: rename domain to core
Diffstat (limited to 'domain/include')
| -rw-r--r-- | domain/include/turns/domain/disposition.hpp | 27 | ||||
| -rw-r--r-- | domain/include/turns/domain/participant.hpp | 58 | ||||
| -rw-r--r-- | domain/include/turns/domain/turn_order.hpp | 85 |
3 files changed, 0 insertions, 170 deletions
diff --git a/domain/include/turns/domain/disposition.hpp b/domain/include/turns/domain/disposition.hpp deleted file mode 100644 index d9b8b5b..0000000 --- a/domain/include/turns/domain/disposition.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef TURNS_DOMAIN_DISPOSITION_HPP -#define TURNS_DOMAIN_DISPOSITION_HPP - -#include <compare> -#include <cstdint> - -#include <glibmm/ustring.h> - -namespace turns::domain -{ - - enum struct disposition : std::uint8_t - { - neutral, - friendly, - hostile, - secret, - - ///! End marker - END - }; - - auto presentation_name_for(disposition value) -> Glib::ustring; - -} // namespace turns::domain - -#endif
\ No newline at end of file diff --git a/domain/include/turns/domain/participant.hpp b/domain/include/turns/domain/participant.hpp deleted file mode 100644 index b51425d..0000000 --- a/domain/include/turns/domain/participant.hpp +++ /dev/null @@ -1,58 +0,0 @@ -#ifndef TURNS_DOMAIN_PARTICIPANT_HPP -#define TURNS_DOMAIN_PARTICIPANT_HPP - -#include "turns/domain/disposition.hpp" - -#include <compare> - -#include <glibmm/object.h> -#include <glibmm/property.h> -#include <glibmm/propertyproxy.h> -#include <glibmm/refptr.h> -#include <glibmm/ustring.h> - -namespace turns::domain -{ - struct participant : Glib::Object - { - auto static create(Glib::ustring name, float priority, disposition disposition) -> Glib::RefPtr<participant>; - - participant(); - participant(Glib::ustring name, float priority, disposition disposition); - - auto operator<=>(participant const & other) const noexcept -> std::partial_ordering; - - template<typename Self> - auto disposition(this Self && self) - { - return self.m_disposition.get_proxy(); - } - - template<typename Self> - auto is_active(this Self && self) - { - return self.m_is_active.get_proxy(); - } - - template<typename Self> - auto name(this Self && self) - { - return self.m_name.get_proxy(); - } - - template<typename Self> - auto priority(this Self && self) - { - return self.m_priority.get_proxy(); - } - - private: - Glib::Property<domain::disposition> m_disposition{*this, "disposition", domain::disposition::neutral}; - Glib::Property<bool> m_is_active{*this, "active", false}; - Glib::Property<Glib::ustring> m_name{*this, "name", ""}; - Glib::Property<float> m_priority{*this, "priority", 0.0f}; - }; - -} // namespace turns::domain - -#endif
\ No newline at end of file diff --git a/domain/include/turns/domain/turn_order.hpp b/domain/include/turns/domain/turn_order.hpp deleted file mode 100644 index ca44b62..0000000 --- a/domain/include/turns/domain/turn_order.hpp +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef TURNS_DOMAIN_TURN_ORDER_HPP -#define TURNS_DOMAIN_TURN_ORDER_HPP - -#include "turns/domain/disposition.hpp" -#include "turns/domain/participant.hpp" - -#include <initializer_list> -#include <limits> -#include <optional> -#include <vector> - -#include <giomm/listmodel.h> -#include <glibmm/property.h> -#include <glibmm/refptr.h> -#include <glibmm/ustring.h> - -namespace turns::domain -{ - - struct turn_order : Gio::ListModel, - Glib::Object - { - using value_type = Glib::RefPtr<participant>; - using container_type = std::vector<value_type>; - using iterator = container_type::iterator; - using const_iterator = container_type::const_iterator; - - using active_participant_type = unsigned int; - using is_empty_type = bool; - using has_next_type = bool; - using has_previous_type = bool; - using is_running_type = bool; - using round_number_type = unsigned int; - - auto static constexpr invalid_participant_index = std::numeric_limits<active_participant_type>::max(); - auto static constexpr invalid_round_number = std::numeric_limits<round_number_type>::max(); - - /** Life-time */ - turn_order(); - - auto static create() -> Glib::RefPtr<turn_order>; - - /** Properties */ - auto is_empty() const -> Glib::PropertyProxy_ReadOnly<is_empty_type>; - auto has_next() const -> Glib::PropertyProxy_ReadOnly<has_next_type>; - auto has_previous() const -> Glib::PropertyProxy_ReadOnly<has_previous_type>; - auto is_running() const -> Glib::PropertyProxy_ReadOnly<is_running_type>; - auto round_number() const -> Glib::PropertyProxy_ReadOnly<round_number_type>; - - /** Element Modifications */ - auto add(Glib::ustring const & name, float priority, disposition disposition) -> void; - auto clear() -> void; - auto remove(unsigned index) -> void; - - /** Turn Modification */ - auto next() -> void; - auto previous() -> void; - auto start() -> void; - auto stop() -> void; - - private: - auto get_item_type_vfunc() -> GType override; - auto get_n_items_vfunc() -> unsigned override; - auto get_item_vfunc(unsigned position) -> void * override; - - /** Signal handlers */ - auto handle_priority_changed(value_type entry) -> void; - - /** Data management */ - auto find(value_type entry) const -> const_iterator; - auto insert(value_type entry) -> const_iterator; - - container_type m_data{}; - std::optional<unsigned> m_active{}; - - Glib::Property<has_next_type> m_has_next{*this, "has-next", false}; - Glib::Property<has_previous_type> m_has_previous{*this, "has-previous", false}; - Glib::Property<is_empty_type> m_is_empty{*this, "is-empty", true}; - Glib::Property<is_running_type> m_is_running{*this, "is-running", false}; - Glib::Property<round_number_type> m_round_number{*this, "round-number", invalid_round_number}; - }; - -} // namespace turns::domain - -#endif
\ No newline at end of file |
