mFrame
載入中...
搜尋中...
無符合項目
Integers.h
1
7#ifndef MFRAME_E2DC1ED1_7C31_4A99_AF60_2B859E6190C9
8#define MFRAME_E2DC1ED1_7C31_4A99_AF60_2B859E6190C9
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15#include "./../lang/NonInstantiable.h"
16#include "./../numb/Integer.h"
17
18//----------------------------------------------------------------------------------------
19
20/* ***************************************************************************************
21 * Namespace
22 */
23namespace ufm::numb {
24 class Integers;
25} // namespace ufm::numb
26
27/* ***************************************************************************************
28 * Class/Interface/Struct/Enum
29 */
30
45 /* *************************************************************************************
46 * Variable
47 */
48
49 /* *************************************************************************************
50 * Abstract Method
51 */
52
53 /* *************************************************************************************
54 * Construct Method
55 */
56 protected:
61 virtual ~Integers(void) override = default;
62
63 /* *************************************************************************************
64 * Operator Method
65 */
66
67 /* *************************************************************************************
68 * Override Method
69 */
70
71 /* *************************************************************************************
72 * Public Method
73 */
74
75 /* *************************************************************************************
76 * Protected Method
77 */
78
79 /* *************************************************************************************
80 * Private Method
81 */
82
83 /* *************************************************************************************
84 * Static Variable
85 */
86
87 public:
88 static constexpr const char* const TEXT_MAX_VALUE =
89 "+2147483647";
90 static constexpr const char* const TEXT_MIN_VALUE =
91 "-2147483648";
92
93 static constexpr const int MAX_ASCII_VALUE =
94 static_cast<int>(sizeof("-2147483648"));
95
96 static constexpr const int MAX_ASCII_OCTAL =
97 static_cast<int>(sizeof("07777777777777777"));
98
99 static constexpr const int MAX_ASCII_HEX =
100 static_cast<int>(sizeof("0xFFFFFFFF"));
101
102 /* *************************************************************************************
103 * Static Method
104 */
105 public:
112 static inline uint32 castUnsigned(int value) {
113 return static_cast<uint32>(value);
114 }
115
122 static inline int castSigned(uint32 value) {
123 return static_cast<int>(value);
124 }
125
136 static bool isInteger(const char* str, int count = -1);
137
148 static bool parseInteger(int& result, const char* str);
149};
150
151/* ***************************************************************************************
152 * End of file
153 */
154
155#endif /* MFRAME_E2DC1ED1_7C31_4A99_AF60_2B859E6190C9 */
Definition NonInstantiable.h:29
整數靜態工具類
Definition Integers.h:44
static constexpr const char *const TEXT_MAX_VALUE
最大值字符串表示
Definition Integers.h:88
static constexpr const int MAX_ASCII_HEX
最大十六進制ASCII長度
Definition Integers.h:99
static int castSigned(uint32 value)
轉換為有符號整數
Definition Integers.h:122
virtual ~Integers(void) override=default
Destroy the Integers object.
static bool parseInteger(int &result, const char *str)
將字串解析為整數
static constexpr const int MAX_ASCII_VALUE
最大ASCII值長度
Definition Integers.h:93
static bool isInteger(const char *str, int count=-1)
判斷字串是否為有效整數格式
static constexpr const char *const TEXT_MIN_VALUE
最小值字符串表示
Definition Integers.h:90
static constexpr const int MAX_ASCII_OCTAL
最大八進制ASCII長度
Definition Integers.h:96
static uint32 castUnsigned(int value)
轉換為無符號整數
Definition Integers.h:112
Definition Boolean.h:23