Refactoring

This commit is contained in:
Changhua 2025-02-03 23:18:20 +08:00
parent 0fd3449894
commit ff1a8c9807

View File

@ -5,29 +5,42 @@
typedef uint64_t QWORD; typedef uint64_t QWORD;
struct WxString { class WxString
{
public:
const wchar_t *wptr; const wchar_t *wptr;
DWORD size; DWORD size;
DWORD capacity; DWORD capacity;
const char *ptr; const char *ptr;
DWORD clen; DWORD clen;
WxString() WxString()
{ {
wptr = NULL; wptr = nullptr;
size = 0; size = 0;
capacity = 0; capacity = 0;
ptr = NULL; ptr = nullptr;
clen = 0; clen = 0;
} }
WxString(std::wstring &ws) WxString(std::wstring ws) : internal_ws(std::move(ws))
{ {
wptr = ws.c_str(); wptr = internal_ws.c_str();
size = (DWORD)ws.size(); size = static_cast<DWORD>(internal_ws.size());
capacity = (DWORD)ws.capacity(); capacity = static_cast<DWORD>(internal_ws.capacity());
ptr = NULL; ptr = nullptr;
clen = 0; clen = 0;
} }
WxString(const WxString &) = delete;
WxString &operator=(const WxString &) = delete;
WxString(WxString &&) noexcept = default;
WxString &operator=(WxString &&) noexcept = default;
private:
std::wstring internal_ws;
}; };
typedef struct RawVector { typedef struct RawVector {