-
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathPointGridWithBorder.hpp
More file actions
374 lines (326 loc) · 16.1 KB
/
PointGridWithBorder.hpp
File metadata and controls
374 lines (326 loc) · 16.1 KB
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
/*#######################################################################################
Copyright (c) 2017-2019 Kasugaccho
Copyright (c) 2018-2019 As Project
https://github.com/Kasugaccho/DungeonTemplateLibrary
wanotaitei@gmail.com
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#######################################################################################*/
#ifndef INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_SHAPE_POINT_GRID_WITH_BORDER_HPP
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_SHAPE_POINT_GRID_WITH_BORDER_HPP
/*#######################################################################################
日本語リファレンス (Reference-JP)
https://github.com/Kasugaccho/DungeonTemplateLibrary/wiki/dtl::shape::PointGridWithBorder-(形状クラス)/
#######################################################################################*/
#include <DTL/Base/Struct.hpp>
#include <DTL/Macros/constexpr.hpp>
#include <DTL/Macros/nodiscard.hpp>
#include <DTL/Shape/BorderOdd.hpp>
#include <DTL/Shape/PointGrid.hpp>
#include <DTL/Type/Forward.hpp>
#include <DTL/Type/SizeT.hpp>
/*#######################################################################################
[概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
[Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
#######################################################################################*/
namespace dtl {
inline namespace shape { //"dtl::shape"名前空間に属する
//マップの外枠を指定した数値で埋め、偶数マスを指定した数値で埋める
template<typename Matrix_Var_>
class PointGridWithBorder {
private:
///// エイリアス (Alias) /////
using Index_Size = ::dtl::type::size;
///// メンバ変数 (Member Variable) /////
::dtl::shape::BorderOdd<Matrix_Var_> borderOdd{};
::dtl::shape::PointGrid<Matrix_Var_> pointGrid{};
public:
///// メンバ変数の値を取得 (Get Value) /////
/*#######################################################################################
[概要] 描画始点座標Xを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing start point coordinate X.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getPointX() const noexcept {
return this->borderOdd.getPointX();
}
/*#######################################################################################
[概要] 描画始点座標Yを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing start point coordinate Y.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getPointY() const noexcept {
return this->borderOdd.getPointY();
}
/*#######################################################################################
[概要] 描画横幅Wを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing width.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getWidth() const noexcept {
return this->borderOdd.getWidth();
}
/*#######################################################################################
[概要] 描画縦幅Hを取得する。
[戻り値] 戻り値の型は std::size_t である。
[Summary] Gets the drawing height.
[Return value] The return type is std::size_t.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Index_Size getHeight() const noexcept {
return this->borderOdd.getHeight();
}
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getValue() const noexcept {
return this->borderOdd.getValue();
}
///// 生成呼び出し (Drawing Function Call) /////
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool draw(Matrix_& matrix_, Args_&& ... args_) const noexcept {
this->pointGrid.draw(matrix_, args_...);
this->borderOdd.draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return true;
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawOperator(Matrix_& matrix_, Args_&& ... args_) const noexcept {
this->pointGrid.drawOperator(matrix_, args_...);
this->borderOdd.drawOperator(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return true;
}
//Array
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawArray(Matrix_& matrix_, Args_&& ... args_) const noexcept {
this->pointGrid.drawArray(matrix_, args_...);
this->borderOdd.drawArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return true;
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
bool drawOperatorArray(Matrix_& matrix_, Args_&& ... args_) const noexcept {
this->pointGrid.drawOperatorArray(matrix_, args_...);
this->borderOdd.drawOperatorArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return true;
}
///// 生成呼び出しファンクタ (Drawing Functor) /////
template<typename Matrix_, typename ...Args_>
constexpr bool operator()(Matrix_& matrix_, Args_&& ... args_) const noexcept {
return this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
}
///// ダンジョン行列生成 (Create Dungeon Matrix) /////
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& create(Matrix_&& matrix_, Args_&& ... args_) const noexcept {
this->draw(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createArray(Matrix_&& matrix_, Args_&& ... args_) const noexcept {
this->drawArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createOperator(Matrix_&& matrix_, Args_&& ... args_) const noexcept {
this->drawOperator(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
template<typename Matrix_, typename ...Args_>
DTL_VERSIONING_CPP14_CONSTEXPR
Matrix_&& createOperatorArray(Matrix_&& matrix_, Args_&& ... args_) const noexcept {
this->drawOperatorArray(matrix_, DTL_TYPE_FORWARD<Args_>(args_)...);
return DTL_TYPE_FORWARD<Matrix_>(matrix_);
}
///// 消去 (Clear) /////
/*#######################################################################################
[概要] 描画始点座標Xを初期値に戻す(描画始点座標Xを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate X to the initial value (deletes the drawing start coordinate X).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearPointX() noexcept {
this->borderOdd.clearPointX();
this->pointGrid.clearPointX();
return *this;
}
/*#######################################################################################
[概要] 描画始点座標Yを初期値に戻す(描画始点座標Yを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate Y to the initial value (deletes the drawing start coordinate Y).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearPointY() noexcept {
this->borderOdd.clearPointY();
this->pointGrid.clearPointY();
return *this;
}
/*#######################################################################################
[概要] 範囲の大きさ(X軸方向)を初期値に戻す(描画横幅Wを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the width of the range (X axis direction) to the initial value (deletes the drawing width).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearWidth() noexcept {
this->borderOdd.clearWidth();
this->pointGrid.clearWidth();
return *this;
}
/*#######################################################################################
[概要] 範囲の大きさ(Y軸方向)を初期値に戻す(描画縦幅Hを消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the height of the range (Y axis direction) to the initial value (deletes the drawing height).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearHeight() noexcept {
this->borderOdd.clearHeight();
this->pointGrid.clearHeight();
return *this;
}
/*#######################################################################################
[概要] 塗り値を初期値に戻す(描画値を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing value to the initial value (deletes the drawing value).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearValue() noexcept {
this->borderOdd.clearValue();
this->pointGrid.clearValue();
return *this;
}
/*#######################################################################################
[概要] 描画始点座標(X,Y)を初期値に戻す(描画始点座標(X,Y)を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing start coordinate (X, Y) to the initial value (deletes the drawing start coordinate (X, Y)).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearPoint() noexcept {
this->clearPointX();
this->clearPointY();
return *this;
}
/*#######################################################################################
[概要] 描画範囲を初期値に戻す(描画範囲(X,Y,W,H)を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Resets the drawing range to the initial value (deletes the drawing range (X, Y, W, H)).
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clearRange() noexcept {
this->clearPointX();
this->clearPointY();
this->clearWidth();
this->clearHeight();
return *this;
}
/*#######################################################################################
[概要] 全ての値を初期値に戻す。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Reset all values to their initial values.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& clear() noexcept {
this->clearRange();
this->clearValue();
return *this;
}
///// 代入 /////
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setPointX(const Index_Size end_x_) noexcept {
this->borderOdd.setPointX(end_x_);
this->pointGrid.setPointX(end_x_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setPointY(const Index_Size end_y_) noexcept {
this->borderOdd.setPointY(end_y_);
this->pointGrid.setPointY(end_y_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setWidth(const Index_Size width_) noexcept {
this->borderOdd.setWidth(width_);
this->pointGrid.setWidth(width_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setHeight(const Index_Size height_) noexcept {
this->borderOdd.setHeight(height_);
this->pointGrid.setHeight(height_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setValue(const Matrix_Var_& draw_value_) noexcept {
this->borderOdd.setValue(draw_value_);
this->pointGrid.setValue(draw_value_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setRange(const ::dtl::base::MatrixRange& matrix_range_) noexcept {
this->borderOdd.setRange(matrix_range_);
this->pointGrid.setRange(matrix_range_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setPoint(const Index_Size point_) noexcept {
this->setPointX(point_);
this->setPointY(point_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setPoint(const Index_Size end_x_, const Index_Size end_y_) noexcept {
this->setPointX(end_x_);
this->setPointY(end_y_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setRange(const Index_Size end_x_, const Index_Size end_y_, const Index_Size length_) noexcept {
this->setPointX(end_x_);
this->setPointY(end_y_);
this->setWidth(length_);
this->setHeight(length_);
return *this;
}
DTL_VERSIONING_CPP14_CONSTEXPR
PointGridWithBorder& setRange(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_) noexcept {
this->setPointX(end_x_);
this->setPointY(end_y_);
this->setWidth(width_);
this->setHeight(height_);
return *this;
}
///// コンストラクタ (Constructor) /////
PointGridWithBorder() = default;
constexpr explicit PointGridWithBorder(const Matrix_Var_& draw_value_) noexcept
:borderOdd(draw_value_), pointGrid(draw_value_) {}
constexpr PointGridWithBorder(const Matrix_Var_& draw_value_, const Matrix_Var_& draw_value2_) noexcept
:borderOdd(draw_value2_), pointGrid(draw_value_) {}
constexpr PointGridWithBorder(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_) noexcept
:borderOdd(end_x_, end_y_, width_, height_), pointGrid(end_x_, end_y_, width_, height_) {}
constexpr PointGridWithBorder(const Index_Size end_x_, const Index_Size end_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_& draw_value_) noexcept
:borderOdd(end_x_, end_y_, width_, height_, draw_value_), pointGrid(end_x_, end_y_, width_, height_, draw_value_) {}
constexpr explicit PointGridWithBorder(const ::dtl::base::MatrixRange& matrix_range_) noexcept
:borderOdd(matrix_range_), pointGrid(matrix_range_) {}
constexpr PointGridWithBorder(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_) noexcept
:borderOdd(matrix_range_, draw_value_), pointGrid(matrix_range_, draw_value_) {}
constexpr PointGridWithBorder(const ::dtl::base::MatrixRange& matrix_range_, const Matrix_Var_& draw_value_, const Matrix_Var_& draw_value2_) noexcept
:borderOdd(matrix_range_, draw_value2_), pointGrid(matrix_range_, draw_value_) {}
};
}
}
#endif //Included Dungeon Template Library