acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_aaa_other_initial_concepts.h
1// From _initial_concepts.h by camilo on 2023-05-23 <3ThomasBorregaardSorensen!!
2//
3// _numeric_concepts.h
4// acme
5//
6// Created by Camilo Sasuke Thomas Borregaard Soerensen on 29/11/22.
7// Copyright (c) 2022 Camilo Sasuke Tsumanuma. All rights reserved.
8//
9#pragma once
10
11
12template < typename NUMBER >
14 std::is_integral_v < ::std::decay_t < NUMBER > > ||
15 std::is_enum_v < ::std::decay_t < NUMBER > > ||
16 std::is_floating_point_v < ::std::decay_t < NUMBER > >;
17
18
19template < typename POINT >
20concept raw_primitive_point = requires(POINT point)
21{
22 {point.x}->prototype_number;
23 {point.y}->prototype_number;
24};
25
26
27template < typename POINT >
28concept prototype_point = requires(POINT point)
29{
30 {point.x}->prototype_number;
31 {point.y}->prototype_number;
32};
33
34
35template < typename POLE >
36concept prototype_pole = requires(POLE pole)
37{
38 {pole.x}->prototype_number;
39 {pole.y}->prototype_number;
40 {pole.z}->prototype_number;
41};
42
43
44template < typename POINT >
45concept prototype_XY = requires(POINT point)
46{
47 point.X;
48 point.Y;
49};
50
51
52template < typename SIZE >
53concept prototype_size = requires(SIZE size)
54{
55 size.cx;
56 size.cy;
57};
58
59
60template < typename ::i32_size >
61concept prototype_Dimension = requires(::i32_size dimension)
62{
63 dimension.Width;
64 dimension.Height;
65};
66
67
68template < typename DIMENSION >
69concept prototype_dimension = requires(DIMENSION dimension)
70{
71 dimension.width;
72 dimension.height;
73};
74
75
76template < typename RECTANGLE >
77concept prototype_rectangle = requires(RECTANGLE rectangle)
78{
79 rectangle.left;
80 rectangle.top;
81 rectangle.right;
82 rectangle.bottom;
83};
84
85
86template < typename RECTANGLE >
87concept prototype_XYDim = requires(RECTANGLE rectangle)
88{
89 rectangle.X;
90 rectangle.Y;
91 rectangle.Width;
92 rectangle.Height;
93};
94
95
96template < typename RECTANGLE >
97concept prototype_xydim = requires(RECTANGLE rectangle)
98{
99 rectangle.x;
100 rectangle.y;
101 rectangle.width;
102 rectangle.height;
103};
104
105
106template < typename RECTANGLE >
107concept prototype_origin_size = requires(RECTANGLE rectangle)
108{
109 {rectangle.origin}->raw_primitive_point;
110 {rectangle.size}->prototype_dimension;
111};
112
113
114//template < typename ORIGIN_SIZE >
115//concept origin_size = requires(ORIGIN_SIZE origin_size)
116//{
117//
118// { origin_size.origin } -> prototype_point;
119// { origin_size.size } -> prototype_dim;
120//
121//};
122
123
124
125template < prototype_number NUMBER >
126struct argument_of_struct < NUMBER >
127{
128
129 using type = NUMBER;
130
131};
132
133
134
135template < prototype_number NUMBER >
136class point_type;
137
138
139template < prototype_number NUMBER >
140class size_type;
141
142
143template < prototype_number NUMBER >
144class rectangle_type;
145
146
147
148
149
150
151
152
153template < prototype_number NUMBER1, prototype_number NUMBER2 >
154inline void copy(NUMBER1& number1, const NUMBER2& number2)
155{
156
157 number1 = (NUMBER1)number2;
158
159}
160
161
162
163
164
165
166
167template < prototype_XY POINT1, prototype_point POINT2 >
168void copy(POINT1 point1, const POINT2& point2)
169{
170
171 point1.X = (decltype(POINT1::X))point2.x;
172 point1.Y = (decltype(POINT1::Y))point2.y;
173
174}
175
176
177template < prototype_point POINT1, prototype_XY POINT2 >
178void copy(POINT1& point1, const POINT2& point2)
179{
180
181 point1.x = (decltype(POINT1::x))point2.X;
182 point1.y = (decltype(POINT1::y))point2.Y;
183
184}
185
186
187template < prototype_rectangle RECTANGLE1, prototype_rectangle RECTANGLE2 >
188inline void copy(RECTANGLE1 & rectangle1, const RECTANGLE2 & rectangle2)
189{
190
191 rectangle1.left = (::decay<decltype(rectangle1.left)>)rectangle2.left;
192 rectangle1.top = (::decay<decltype(rectangle1.top)>)rectangle2.top;
193 rectangle1.right = (::decay<decltype(rectangle1.right)>)rectangle2.right;
194 rectangle1.bottom = (::decay<decltype(rectangle1.bottom)>)rectangle2.bottom;
195
196}
197
198
199template < prototype_XYDim XYDim, prototype_rectangle RECTANGLE >
200void copy(XYDim& xydim, const RECTANGLE& rectangle)
201{
202
203 xydim.X = (decltype(XYDim::X))rectangle.left;
204 xydim.Y = (decltype(XYDim::Y))rectangle.top;
205 xydim.Width = (decltype(XYDim::Width))(rectangle.right - rectangle.left);
206 xydim.Height = (decltype(XYDim::Height))(rectangle.bottom - rectangle.top);
207
208}
209
210
211template < prototype_xydim XYDIM, prototype_rectangle RECTANGLE >
212void copy(XYDIM& xydim, const RECTANGLE& rectangle)
213{
214
215 xydim.x = (decltype(XYDIM::X))rectangle.left;
216 xydim.y = (decltype(XYDIM::Y))rectangle.top;
217 xydim.width = (decltype(XYDIM::Width))(rectangle.right - rectangle.left);
218 xydim.height = (decltype(XYDIM::Height))(rectangle.bottom - rectangle.top);
219
220}
221
222
223template < prototype_XYDim XYDim1, prototype_XYDim XYDim2 >
224void copy(XYDim1& xydim1, const XYDim2& xydim2)
225{
226
227 xydim1.X = (decltype(XYDim1::X))xydim2.X;
228 xydim1.Y = (decltype(XYDim1::Y))xydim2.Y;
229 xydim1.Width = (decltype(XYDim1::Width))xydim2.Width;
230 xydim1.Height = (decltype(XYDim1::Height))xydim2.Height;
231
232}
233
234
235template < prototype_point POINT1, prototype_point POINT2 >
236void copy(POINT1& point1, const POINT2& point2)
237{
238
239 point1.x = (const ::std::decay_t <decltype(point1.x)>&)point2.x;
240 point1.y = (const ::std::decay_t <decltype(point1.y)>&)point2.y;
241
242}
243
244
245template < prototype_point POINT1, raw_primitive_point POINT2 >
246void copy(POINT1& point1, const POINT2& point2)
247{
248
249 point1.x = (const ::std::decay_t <decltype(point1.x)>&)point2.x;
250 point1.y = (const ::std::decay_t <decltype(point1.y)>&)point2.y;
251
252}
253
254template < raw_primitive_point POINT1, prototype_point POINT2 >
255void copy(POINT1& point1, const POINT2& point2)
256{
257
258 point1.x = (const ::std::decay_t <decltype(point1.x)>&)point2.x;
259 point1.y = (const ::std::decay_t <decltype(point1.y)>&)point2.y;
260
261}
262
263
264template < prototype_point POINT, prototype_size SIZE >
265void copy(POINT& point, const SIZE& size)
266{
267
268 point.x = (const ::std::decay_t <decltype(point.x)>&)size.cx;
269 point.y = (const ::std::decay_t <decltype(point.y) > &)size.cy;
270
271}
272
273
274template < prototype_size SIZE_TYPE1, prototype_size SIZE_TYPE2 >
275void copy(SIZE_TYPE1& size1, const SIZE_TYPE2& size2)
276{
277
278 size1.cx = (decltype(SIZE_TYPE1::cx))size2.cx;
279 size1.cy = (decltype(SIZE_TYPE1::cy))size2.cy;
280
281}
282
283
284
285
286
287
Definition point.h:12
Definition rectangle.h:49
Definition size.h:11
Definition _aaa_other_initial_concepts.h:61
Definition _aaa_other_initial_concepts.h:87
Definition _aaa_other_initial_concepts.h:45
Definition _aaa_other_initial_concepts.h:69
Definition _aaa_other_initial_concepts.h:13
Definition _aaa_other_initial_concepts.h:107
Definition _aaa_other_initial_concepts.h:28
Definition _aaa_other_initial_concepts.h:36
Definition _aaa_other_initial_concepts.h:77
Definition _aaa_other_initial_concepts.h:53
Definition _aaa_other_initial_concepts.h:97
Definition _aaa_other_initial_concepts.h:20
Definition _forward_declaration.h:2520