1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
#include "turnsmm/participant.hpp"
#include "turns-disposition.h"
#include "turns-participant.h"
#include "turnsmm/private/participant_p.hpp"
#include <glibmm/class.h>
#include <glibmm/object.h>
#include <glibmm/objectbase.h>
#include <glibmm/private/object_p.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/utility.h>
#include <glibmm/wrap.h>
#include <glib-object.h>
#include <bit>
namespace Turns
{
namespace
{
auto constinit _class = Participant_Class{};
auto constexpr type_name = "TurnsParticipant";
} // 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<BaseClassType *>(gclass);
CppClassParent::class_init_function(klass, data);
}
auto Participant_Class::wrap_new(GObject * object) -> Glib::ObjectBase *
{
return new Participant(TURNS_PARTICIPANT(object));
}
Participant::Participant()
: Glib::ObjectBase{type_name}
, Glib::Object{Glib::ConstructParams{_class.init()}}
{
}
Participant::Participant(Glib::ustring const & name, float priority, int disposition)
: Glib::ObjectBase{type_name}
, Glib::Object{Glib::ConstructParams{_class.init(), "name", name.c_str(), "priority", priority, "disposition", disposition, nullptr}}
{
}
auto Participant::gobj() noexcept -> BaseObjectType *
{
return std::bit_cast<BaseObjectType *>(gobject_);
}
auto Participant::gobj() const -> BaseObjectType const *
{
return std::bit_cast<BaseObjectType const *>(gobject_);
}
auto Participant::gobj_copy() noexcept -> BaseObjectType *
{
reference();
return gobj();
}
auto Participant::get_active() const noexcept -> bool
{
return turns_participant_get_active(const_cast<BaseObjectType *>(unwrap(this)));
}
auto Participant::get_defeated() const noexcept -> bool
{
return turns_participant_get_defeated(const_cast<BaseObjectType *>(unwrap(this)));
}
auto Participant::get_disposition() const noexcept -> int
{
return turns_participant_get_disposition(const_cast<BaseObjectType *>(unwrap(this)));
}
auto Participant::get_name() const -> Glib::ustring
{
return turns_participant_get_name(const_cast<BaseObjectType *>(unwrap(this)));
}
auto Participant::get_priority() const noexcept -> float
{
return turns_participant_get_priority(const_cast<BaseObjectType *>(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(int value) noexcept -> void
{
return turns_participant_set_disposition(unwrap(this), static_cast<TurnsDisposition>(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);
}
Participant::Participant(BaseObjectType * gobj)
: Glib::Object((GObject *)gobj)
{
}
} // namespace Turns
namespace Glib
{
auto wrap(TurnsParticipant * object, bool copy) -> Glib::RefPtr<Turns::Participant>
{
return Glib::make_refptr_for_instance<Turns::Participant>(dynamic_cast<Turns::Participant *>(Glib::wrap_auto(G_OBJECT(object), copy)));
}
} // namespace Glib
|