8#ifndef MFRAME_D6412968_F88E_43C3_9B72_FA8611376187
9#define MFRAME_D6412968_F88E_43C3_9B72_FA8611376187
14#include "./../lang/Object.h"
15#include "./../lang/Pointers.h"
107 inline operator void*(void) {
108 return this->vPointer;
116 inline operator const char*(void) {
117 return reinterpret_cast<const char*
>(this->vPointer);
128 return (this->vPointer ==
pointer);
139 return (this->vPointer ==
pointer.vPointer);
148 template <
typename E>
149 inline operator E*(void) {
150 return static_cast<E*
>(this->vPointer);
159 template <
typename E>
160 inline operator E*(void)
const {
161 return static_cast<E*
>(this->vPointer);
186 inline int copyTo(
void* destination,
int length)
const {
187 return this->
copyTo(destination, 0, 0, length);
198 inline int copyTo(
void* destination,
int start,
int length)
const {
199 return this->
copyTo(destination, 0, start, length);
233 inline bool compair(
const void* source,
int length)
const {
234 return this->
compair(source, 0, 0, length);
246 inline bool compair(
const void* source,
int start,
int length)
const {
247 return this->
compair(source, 0, start, length);
258 inline int indexOf(
char ch,
int start,
int limit)
const {
293 inline int copy(
const void* source,
int length) {
294 return this->
copy(source, 0, 0, length);
305 inline int copy(
const void* source,
int offset,
int length) {
306 return this->
copy(source, offset, 0, length);
316 const char* p =
static_cast<const char*
>(this->vPointer);
327 const int* p =
static_cast<const int*
>(this->vPointer);
338 const short* p =
static_cast<const short*
>(this->vPointer);
349 return Pointer(&(
static_cast<char*
>(this->vPointer))[offset]);
358 return reinterpret_cast<uint32
>(this->vPointer);
368 return ((this->
getAddress() & 0x00000003) == 0);
378 return ((this->
getAddress() & 0x00000007) == 0);
388 return (this->vPointer ==
nullptr);
397 template <
typename E =
void*>
399 return static_cast<E*
>(this->vPointer);
409 template <
typename E =
void*>
411 return reinterpret_cast<E*
>(
static_cast<char*
>(this->vPointer) + offset);
421 template <
typename E =
void*>
423 return reinterpret_cast<E*
>(
static_cast<char*
>(this->vPointer) + offset);
441 virtual int copy(
const void* source,
int offset,
int sourceOffset,
int length);
456 int destinationOffset,
507 int limit = 0)
const;
540 virtual void move(
int head,
int offset,
int length);
存儲資料的類別,提供動態記憶體管理功能。
Definition Memory.h:44
物件基底類別
Definition Object.h:63
提供記憶體位址存取與操作功能
Definition Pointer.h:44
bool compairStrings(const char *str, int start) const
比較內部資料與傳入字串是否相同,可指定來源資料起始位置
Definition Pointer.h:221
virtual int indexOfData(const void *destination, int destinationLen, int start=0, int limit=0) const
尋找指定 pattern 是否存在於內部資料中,並返回第一個符合條件的偏移量
char getByte(int shift) const
取得指定偏移處的 byte 值
Definition Pointer.h:315
bool operator==(const Pointer &pointer)
比較兩個 Pointer 物件的內部指標是否相同
Definition Pointer.h:138
bool isAlignment64Bit(void)
檢查內部位址是否 64 位元對齊
Definition Pointer.h:377
int indexOfStrings(const char *str, int start, int limit) const
在內部資料中查找指定字串,回傳該字串的偏移位置
Definition Pointer.h:281
uint32 getAddress(void) const
取得內部記憶體位址的整數表示
Definition Pointer.h:357
virtual int copyTo(void *destination, int offset, int destinationOffset, int length) const
將內部資料複製到目標記憶體區塊,可指定來源與目標的起始偏移
bool operator==(const void *pointer)
比較內部指標與外部指標是否相同
Definition Pointer.h:127
virtual void move(int head, int offset, int length)
將來源位置的資料以中間緩衝區方式移動至新的位置
bool compair(const void *source, int length) const
比較內部資料與來源資料是否相等(從起始位置開始比較)
Definition Pointer.h:233
virtual bool compair(const void *source, int offset, int sourceOffset, int length) const
比較內部資料與來源資料是否相等,可指定各自的起始偏移與比較長度
short getShort(int shift) const
取得指定偏移處的 short 值
Definition Pointer.h:337
Pointer(const Pointer &other)
複製建構子,從另一個 Pointer 物件複製內部位址
Pointer(const void *pointer)
建立一個 Pointer 物件,並以 const void* 初始化內部指標
int copyTo(void *destination, int length) const
複製內部資料至目標記憶體區塊
Definition Pointer.h:186
E * pointer(void) const
模板方法,取得內部指標並轉換為指定型態(不指定偏移)
Definition Pointer.h:398
Pointer getPointer(int offset) const
以指定偏移建立新的 Pointer 物件
Definition Pointer.h:348
int getInteger(int shift) const
取得指定偏移處的整數值
Definition Pointer.h:326
Pointer(uint32 pointer)
建立一個 Pointer 物件,並以 32 位元整數表示的位址初始化
Pointer(void *pointer)
建立一個 Pointer 物件,並以 void* 初始化內部指標
Pointer & operator=(const Pointer &other)=default
賦值運算子,將另一個 Pointer 物件的內部指標複製到當前物件
int copy(const void *source, int offset, int length)
複製來源資料至內部資料區塊,可指定目標位址偏移
Definition Pointer.h:305
bool compair(const void *source, int start, int length) const
比較內部資料與來源資料是否相等,可指定來源資料的起始偏移
Definition Pointer.h:246
int copyTo(void *destination, int start, int length) const
複製內部資料至目標記憶體區塊,可指定來源起始位置
Definition Pointer.h:198
int indexOf(char ch, int start, int limit) const
在內部資料中查找指定字元 ch,回傳該字元的偏移位置
Definition Pointer.h:258
bool isNull(void) const
檢查內部指標是否為空
Definition Pointer.h:387
E * pointer(int offset) const
模板方法,取得內部指標並轉換為指定型態(指定偏移)
Definition Pointer.h:410
virtual int copy(const void *source, int offset, int sourceOffset, int length)
將來源資料複製至內部記憶體區塊,可指定來源與目標的起始偏移
bool compairStrings(const char *str) const
比較內部資料與傳入字串是否相同(從起始位置開始比較)
Definition Pointer.h:209
E * pointer(uint32 offset) const
模板方法,取得內部指標並轉換為指定型態(指定偏移,使用 uint32 參數)
Definition Pointer.h:422
int indexOfStrings(const char *str, int limit) const
在內部資料中查找指定字串,回傳該字串的偏移位置(使用預設起始位置)
Definition Pointer.h:269
int copy(const void *source, int length)
複製來源資料至內部資料區塊,使用預設偏移參數
Definition Pointer.h:293
bool isAlignment32Bit(void)
檢查內部位址是否 32 位元對齊
Definition Pointer.h:367
static int getStringLength(const char *src)
取得C字串的長度
Definition Appendable.h:23