mFrame
載入中...
搜尋中...
無符合項目
Short.h
1
8#ifndef MFRAME_A35B63D2_8288_4C2E_ACB8_69DAC9906340
9#define MFRAME_A35B63D2_8288_4C2E_ACB8_69DAC9906340
10
11/* ***************************************************************************************
12 * Include
13 */
14
15//----------------------------------------------------------------------------------------
16
17//----------------------------------------------------------------------------------------
18#include "./../numb/Number.h"
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::numb {
24 class Short;
25} // namespace ufm::numb
26
27/* ***************************************************************************************
28 * Class Short
29 */
43class ufm::numb::Short final : public ufm::numb::Number {
44 /* *************************************************************************************
45 * Variable
46 */
47
48 /* *************************************************************************************
49 * Abstract Method
50 */
51
52 /* *************************************************************************************
53 * Construct Method
54 */
55 public:
61 Short(void);
62
69 Short(short value);
70
77 Short(const Short& other);
78
79 /* *************************************************************************************
80 * Operator Method
81 */
82 public:
88 inline operator short(void) {
89 return Short::vValue.s16[0];
90 }
91
99 inline bool operator==(int v) {
100 return (Short::vValue.s16[0] == (v & 0x0000FFFF));
101 }
102
110 inline bool operator==(Short& v) {
111 return (Short::vValue.s16[0] == v.vValue.s16[0]);
112 }
113
121 Short::vValue.s16[0] = v.vValue.s16[0];
122 return Short::vValue.s16[0];
123 }
124
132 Short::vValue.s16[0] += v;
133 return *this;
134 }
135
143 Short::vValue.s16[0] -= v;
144 return *this;
145 }
146
154 Short::vValue.s16[0] *= v;
155 return *this;
156 }
157
165 Short::vValue.s16[0] /= v;
166 return *this;
167 }
168
175 Short tmp = *this;
176 ++Short::vValue.s16[0];
177 return tmp;
178 }
179
186 ++Short::vValue.s16[0];
187 return *this;
188 }
189
196 Short tmp = *this;
197 --Short::vValue.s16[0];
198 return tmp;
199 }
200
207 --Short::vValue.s16[0];
208 return *this;
209 }
210
211 /* *************************************************************************************
212 * Override Method
213 */
214
215 /* *************************************************************************************
216 * Public Method
217 */
218
219 /* *************************************************************************************
220 * Protected Method
221 */
222
223 /* *************************************************************************************
224 * Private Method
225 */
226
227 /* *************************************************************************************
228 * Static Variable
229 */
230
231 /* *************************************************************************************
232 * Static Method
233 */
234};
235
236/* ***************************************************************************************
237 * End of file
238 */
239
240#endif /* MFRAME_A35B63D2_8288_4C2E_ACB8_69DAC9906340 */
[Interface] 數值基礎抽象類
Definition Number.h:44
Value vValue
數值儲存體
Definition Number.h:72
短整數封裝類
Definition Short.h:43
Short operator-=(int v)
減法指定運算子
Definition Short.h:142
Short(void)
建構 Short 物件
Short(short value)
建構 Short 物件
Short operator+=(int v)
加法指定運算子
Definition Short.h:131
Short & operator--(void)
前置遞減運算子
Definition Short.h:206
bool operator==(int v)
比較 Short 物件與整數是否相等
Definition Short.h:99
Short operator++(void)
前置遞增運算子
Definition Short.h:185
Short operator*=(int v)
乘法指定運算子
Definition Short.h:153
Short operator++(int)
後置遞增運算子
Definition Short.h:174
Short operator/=(int v)
除法指定運算子
Definition Short.h:164
Short operator--(int)
後置遞減運算子
Definition Short.h:195
Short(const Short &other)
複製建構 Short 物件
Short operator=(Short v)
指定運算子
Definition Short.h:120
bool operator==(Short &v)
比較兩個 Short 物件是否相等
Definition Short.h:110
Definition Boolean.h:23
short s16[2]
有符號16位元陣列
Definition Number.h:59