#include "turnsmm/participant.hpp" #include "turns-disposition.h" #include "turns-participant.h" #include "turnsmm/enums.hpp" #include "turnsmm/private/participant_p.hpp" #include #include #include #include #include #include #include #include #include #include #include namespace Turns { namespace { auto constinit _class = Participant_Class{}; } // namespace auto Participant_Class::init() -> Glib::Class const & { if (!gtype_) { class_init_func_ = &class_init_function; gtype_ = turns_participant_get_type(); } return *this; } auto Participant_Class::class_init_function(void * gclass, void * data) -> void { auto const klass = static_cast(gclass); CppClassParent::class_init_function(klass, data); } auto Participant_Class::wrap_new(GObject * object) -> Glib::ObjectBase * { return new Participant(TURNS_PARTICIPANT(object)); } auto Participant::get_base_type() -> GType { return turns_participant_get_type(); } auto Participant::get_type() -> GType { return _class.init().get_type(); } auto Participant::create() -> Glib::RefPtr { return Glib::make_refptr_for_instance(new Participant{}); } auto Participant::create(Glib::ustring const & name, float priority, Disposition disposition) -> Glib::RefPtr { return Glib::make_refptr_for_instance(new Participant{name, priority, disposition}); } Participant::Participant() : Glib::ObjectBase{nullptr} , Glib::Object{Glib::ConstructParams{_class.init()}} { } Participant::Participant(Glib::ustring const & name, float priority, Disposition disposition) : Glib::ObjectBase{nullptr} , Glib::Object{Glib::ConstructParams{_class.init(), "name", name.c_str(), "priority", priority, "disposition", disposition, nullptr}} { } auto Participant::gobj() noexcept -> BaseObjectType * { return std::bit_cast(gobject_); } auto Participant::gobj() const -> BaseObjectType const * { return std::bit_cast(gobject_); } auto Participant::gobj_copy() noexcept -> BaseObjectType * { reference(); return gobj(); } auto Participant::get_active() const noexcept -> bool { return turns_participant_get_active(const_cast(unwrap(this))); } auto Participant::get_defeated() const noexcept -> bool { return turns_participant_get_defeated(const_cast(unwrap(this))); } auto Participant::get_disposition() const noexcept -> Disposition { return static_cast(turns_participant_get_disposition(const_cast(unwrap(this)))); } auto Participant::get_name() const -> Glib::ustring { return turns_participant_get_name(const_cast(unwrap(this))); } auto Participant::get_priority() const noexcept -> float { return turns_participant_get_priority(const_cast(unwrap(this))); } auto Participant::set_active(bool value) noexcept -> void { return turns_participant_set_active(unwrap(this), value); } auto Participant::set_defeated(bool value) noexcept -> void { return turns_participant_set_defeated(unwrap(this), value); } auto Participant::set_disposition(Disposition value) noexcept -> void { return turns_participant_set_disposition(unwrap(this), static_cast(value)); } auto Participant::set_name(Glib::ustring const & value) noexcept -> void { return turns_participant_set_name(unwrap(this), value.c_str()); } auto Participant::set_priority(float value) noexcept -> void { return turns_participant_set_priority(unwrap(this), value); } auto Participant::property_active() const noexcept -> Glib::PropertyProxy_ReadOnly { return {this, "active"}; } auto Participant::property_active() noexcept -> Glib::PropertyProxy { return {this, "active"}; } auto Participant::property_defeated() const noexcept -> Glib::PropertyProxy_ReadOnly { return {this, "defeated"}; } auto Participant::property_defeated() noexcept -> Glib::PropertyProxy { return {this, "defeated"}; } auto Participant::property_disposition() const noexcept -> Glib::PropertyProxy_ReadOnly { return {this, "disposition"}; } auto Participant::property_disposition() noexcept -> Glib::PropertyProxy { return {this, "disposition"}; } auto Participant::property_name() const noexcept -> Glib::PropertyProxy_ReadOnly { return {this, "name"}; } auto Participant::property_name() noexcept -> Glib::PropertyProxy { return {this, "name"}; } auto Participant::property_priority() const noexcept -> Glib::PropertyProxy_ReadOnly { return {this, "priority"}; } auto Participant::property_priority() noexcept -> Glib::PropertyProxy { return {this, "priority"}; } Participant::Participant(BaseObjectType * gobj) : Glib::Object((GObject *)gobj) { } } // namespace Turns namespace Glib { auto wrap(TurnsParticipant * object, bool copy) -> Glib::RefPtr { return Glib::make_refptr_for_instance(dynamic_cast(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib