-
-
Notifications
You must be signed in to change notification settings - Fork 87
Expand file tree
/
Copy pathRectBaseWithValue.hpp
More file actions
142 lines (112 loc) · 5.91 KB
/
RectBaseWithValue.hpp
File metadata and controls
142 lines (112 loc) · 5.91 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
/*#######################################################################################
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_RANGE_RECT_BASE_WITH_VALUE_HPP
#define INCLUDED_DUNGEON_TEMPLATE_LIBRARY_DTL_RANGE_RECT_BASE_WITH_VALUE_HPP
#include <DTL/Base/Struct.hpp>
#include <DTL/Macros/constexpr.hpp>
#include <DTL/Macros/nodiscard.hpp>
#include <DTL/Type/SizeT.hpp>
#include <DTL/Range/BasicRect.hpp>
/*#######################################################################################
[概要] "dtl名前空間"とは"DungeonTemplateLibrary"の全ての機能が含まれる名前空間である。
[Summary] The "dtl" is a namespace that contains all the functions of "DungeonTemplateLibrary".
#######################################################################################*/
namespace dtl {
inline namespace range { //"dtl::range"名前空間に属する
//四角形クラス
template<typename Derived_, typename Matrix_Var_, Matrix_Var_ matrix_value_ = Matrix_Var_{} >
class RectBaseWithValue : public ::dtl::range::BasicRect<Derived_> {
private:
///// エイリアス (Alias) /////
using Index_Size = ::dtl::type::size;
using RectBase_t = ::dtl::range::BasicRect<Derived_>;
protected:
///// メンバ変数 (Member Variable) /////
Matrix_Var_ draw_value{ matrix_value_ };
public:
///// メンバ変数の値を取得 (Get Value) /////
/*#######################################################################################
[概要] 描画値を取得する。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[参考ページ] https://github.com/Kasugaccho/DungeonTemplateLibrary/wiki/dtl::XX::YY::getValue-(形状描画)/
[Summary] Gets the drawing value.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
template<typename Matrix_Int1_>
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& getValue(Matrix_Int1_& value_) noexcept {
value_ = static_cast<Matrix_Int1_>(this->draw_value);
return static_cast<Derived_&>(*this);
}
/*#######################################################################################
[概要] 描画値を取得する。
[戻り値] 戻り値の型は Matrix_Var_ である。
[参考ページ] https://github.com/Kasugaccho/DungeonTemplateLibrary/wiki/dtl::XX::YY::getValue-(形状描画)/
[Summary] Gets the drawing value.
[Return value] The return type is Matrix_Var_.
#######################################################################################*/
DTL_VERSIONING_CPP17_NODISCARD
constexpr Matrix_Var_ getValue() const noexcept {
return this->draw_value;
}
///// 消去 (Clear) /////
/*#######################################################################################
[概要] 塗り値を初期値に戻す(描画値を消去する)。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[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
Derived_& clearValue() noexcept {
const Matrix_Var_ new_draw_value{};
this->draw_value = new_draw_value;
return static_cast<Derived_&>(*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
Derived_& clear() noexcept {
this->clearRange();
this->clearValue();
return static_cast<Derived_&>(*this);
}
///// 代入 /////
/*#######################################################################################
[概要] 描画値を設定する。
[戻り値] 戻り値の型は 当クラスの参照値 である。
[Summary] Set the drawing value.
[Return value] The return type is a reference value of this class.
#######################################################################################*/
DTL_VERSIONING_CPP14_CONSTEXPR
Derived_& setValue(const Matrix_Var_& draw_value_) noexcept {
this->draw_value = draw_value_;
return static_cast<Derived_&>(*this);
}
///// コンストラクタ (Constructor) /////
RectBaseWithValue() = default;
constexpr explicit RectBaseWithValue(const ::dtl::base::MatrixRange& matrix_range_) noexcept
:RectBase_t(matrix_range_) {}
constexpr RectBaseWithValue(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_) {}
constexpr explicit RectBaseWithValue(const Matrix_Var_ & draw_value_) noexcept
:draw_value(draw_value_) {}
constexpr RectBaseWithValue(const ::dtl::base::MatrixRange & matrix_range_, const Matrix_Var_ & draw_value_) noexcept
:RectBase_t(matrix_range_),
draw_value(draw_value_) {}
constexpr RectBaseWithValue(const Index_Size start_x_, const Index_Size start_y_, const Index_Size width_, const Index_Size height_, const Matrix_Var_ & draw_value_) noexcept
:RectBase_t(start_x_, start_y_, width_, height_),
draw_value(draw_value_) {}
};
}
}
#endif //Included Dungeon Template Library