mFrame
載入中...
搜尋中...
無符合項目
Pointers.h
1
7#ifndef MFRAME_27CD9666_FD9F_478C_983C_06FC70DDE127
8#define MFRAME_27CD9666_FD9F_478C_983C_06FC70DDE127
9
10/* ***************************************************************************************
11 * Include
12 */
13
14//----------------------------------------------------------------------------------------
15
16//----------------------------------------------------------------------------------------
17#include "./../lang/Object.h"
18
19/* ***************************************************************************************
20 * Namespace
21 */
22namespace mframe::lang {
23 class Pointers;
24} // namespace mframe::lang
25
26/* ***************************************************************************************
27 * Class/Interface/Struct/Enum
28 */
30 /* *************************************************************************************
31 * Variable
32 */
33
34 /* *************************************************************************************
35 * Abstract Method
36 */
37
38 /* *************************************************************************************
39 * Construct Method
40 */
41 private:
46 Pointers(void);
47
48 public:
53 virtual ~Pointers(void) override;
54
55 /* *************************************************************************************
56 * Operator Method
57 */
58
59 /* *************************************************************************************
60 * Public Method <Override>
61 */
62
63 /* *************************************************************************************
64 * Public Method
65 */
66
67 /* *************************************************************************************
68 * Protected Method
69 */
70
71 /* *************************************************************************************
72 * Private Method
73 */
74
75 /* *************************************************************************************
76 * Static Variable
77 */
78 private:
79 static void* const vNullPointer;
80 /* *************************************************************************************
81 * Static Method
82 */
83 public:
89 static void* const& getReferenceNullPointer(void);
90
97 static inline uint32 toUnsignedInt(const void* pointer) {
98 return reinterpret_cast<uint32>(pointer);
99 }
100
107 static inline uint32 toSignedInt(const void* pointer) {
108 return reinterpret_cast<uint32>(pointer);
109 }
110
118 template <class T>
119 static T* shift(T* pointer, int shift) {
120 return reinterpret_cast<T*>(reinterpret_cast<int>(pointer) + shift);
121 }
122
131 template <class T>
132 static const T* shift(const T* pointer, int shift) {
133 return reinterpret_cast<T*>(reinterpret_cast<int>(pointer) + shift);
134 }
135
144 template <class T>
145 static inline T* cast(void* src) {
146 return static_cast<T*>(src);
147 }
148
157 template <class T>
158 static inline T* cast(uint32 address) {
159 return static_cast<T*>(reinterpret_cast<void*>(address));
160 }
161
186 static void copy(void* destination, const void* source, int length);
187
204 static void move(void* destination, const void* source, int length);
205
217 static int compare(const void* src1, const void* src2, int length);
218
226 static void wipe(void* src, int value, int length);
227
234 static void wipe(void* src, int length);
235
242 static int getStringLength(const char* src);
243};
244
245/* ***************************************************************************************
246 * End of file
247 */
248
249#endif /* MFRAME_27CD9666_FD9F_478C_983C_06FC70DDE127 */
Definition Object.h:34
Definition Pointers.h:29
static int getStringLength(const char *src)
static uint32 toSignedInt(const void *pointer)
轉換為整數
Definition Pointers.h:107
virtual ~Pointers(void) override
Destroy the Pointers object.
static void wipe(void *src, int length)
複製字符0x00到參數str所指向的字符串的前length個字符。
static int compare(const void *src1, const void *src2, int length)
前n個字節的內存區域src1和存儲區src2中比較。
static T * cast(uint32 address)
Definition Pointers.h:158
static void copy(void *destination, const void *source, int length)
Copies the values of num bytes from the location pointed to by source directly to the memory block po...
static void wipe(void *src, int value, int length)
複製字符 c(一個無符號字符)到參數 str 所指向的字符串的前 n 個字符。
static T * shift(T *pointer, int shift)
地址偏移
Definition Pointers.h:119
static T * cast(void *src)
Definition Pointers.h:145
static void *const & getReferenceNullPointer(void)
Get the Reference Null Pointer object.
static void move(void *destination, const void *source, int length)
將來源位置的資料複製指定的字節數(num bytes)到目標記憶體區塊中。 複製過程如同使用中間緩衝區進行,因此允許目標與來源記憶體區塊重疊。
static const T * shift(const T *pointer, int shift)
常數地址偏移
Definition Pointers.h:132
static uint32 toUnsignedInt(const void *pointer)
轉換為無符號整數
Definition Pointers.h:97
Definition Appendable.h:23