mFrame
載入中...
搜尋中...
無符合項目
Memory.h
1
8#ifndef MFRAME_D6A75B59_D8E5_4FB2_BAB8_41477CE17D21
9#define MFRAME_D6A75B59_D8E5_4FB2_BAB8_41477CE17D21
10
11/* ***************************************************************************************
12 * Include
13 */
14
15//----------------------------------------------------------------------------------------
16#include "./../lang/Data.h"
17#include "./../lang/NonCopyable.h"
18
19/* ***************************************************************************************
20 * Namespace
21 */
22namespace ufm::lang {
23 class Memory;
24 class String;
25} // namespace ufm::lang
26
27/* ***************************************************************************************
28 * Class/struct/Struct
29 */
30
45 /* *************************************************************************************
46 * Variable
47 */
48 private:
49 Memory* vNext;
50
51 /* *************************************************************************************
52 * Abstract Method
53 */
54
55 /* *************************************************************************************
56 * Construct Method
57 */
58 public:
63 explicit Memory(const Data& data);
64
70 inline Memory(const void* pointer, int length) : Memory(Data(pointer, length)) {
71 return;
72 }
73
79 inline Memory(void* pointer, int length) : Memory(Data(pointer, length)) {
80 return;
81 }
82
88 inline Memory(void* pointer, uint32 length)
89 : Memory(Data(pointer, static_cast<int>(length))) {
90 return;
91 }
92
98
103 Memory(Memory& other) noexcept;
104
109 Memory(Memory&& other) noexcept;
110
114 virtual ~Memory(void) override;
115
116 /* *************************************************************************************
117 * Operator Method
118 */
119
120 /* *************************************************************************************
121 * Public Method
122 */
123 public:
128 inline bool isHeapMemory(void) const {
129 return (this->vNext != nullptr);
130 }
131
137 bool resize(int size);
138
139 /* *************************************************************************************
140 * Protected Method
141 */
142
143 /* *************************************************************************************
144 * Private Method
145 */
146
147 /* *************************************************************************************
148 * Static Variable
149 */
150
151 /* *************************************************************************************
152 * Static Method
153 */
154 public:
159 static inline ufm::lang::Memory nullMemory(void) {
160 return Memory(static_cast<const void*>(nullptr), 0);
161 }
162};
163
164/* ***************************************************************************************
165 * End of file
166 */
167
168#endif /* MFRAME_D6A75B59_D8E5_4FB2_BAB8_41477CE17D21 */
資料處理類別
Definition Data.h:43
int length(void) const
取得資料有效長度
Definition Data.h:139
存儲資料的類別,提供動態記憶體管理功能。
Definition Memory.h:44
Memory(void *pointer, int length)
以指標與長度建構 Memory 實例
Definition Memory.h:79
virtual ~Memory(void) override
釋放記憶體資源並執行清理
Memory(Memory &other) noexcept
淺層複製構造器(移動語意)
Memory(void *pointer, uint32 length)
以 const 指標與長度建構 Memory 實例
Definition Memory.h:88
bool isHeapMemory(void) const
判斷是否為堆記憶體
Definition Memory.h:128
Memory(int length)
以指定長度建構 Memory 實例
Memory(const Data &data)
以資料物件建構 Memory 實例
static ufm::lang::Memory nullMemory(void)
取得一個空的 Memory 物件
Definition Memory.h:159
Memory(Memory &&other) noexcept
移動構造器
bool resize(int size)
調整記憶體大小
Memory(const void *pointer, int length)
以 const 指標與長度建構 Memory 實例
Definition Memory.h:70
E * pointer(void) const
模板方法,取得內部指標並轉換為指定型態(不指定偏移)
Definition Pointer.h:398
Definition Appendable.h:23
禁止複製的結構
Definition NonCopyable.h:38