aboutsummaryrefslogtreecommitdiff
path: root/c/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/common.h')
-rw-r--r--c/common.h27
1 files changed, 14 insertions, 13 deletions
diff --git a/c/common.h b/c/common.h
index 0851bb6..f011565 100644
--- a/c/common.h
+++ b/c/common.h
@@ -8,21 +8,22 @@
int EBMessageBox(const wchar_t* wszText, const wchar_t* wszCaption, unsigned uType);
int GetRelativeCursorPos(HWND hWnd, POINT* pt);
-struct wstring_owner
+struct wchar_ptr
{
- static wstring_owner from_narrow(const char* buf, int cp = CP_UTF8);
- static wstring_owner copy(const wchar_t* s);
- wstring_owner();
- wstring_owner(wchar_t* s);
- wstring_owner& operator=(wchar_t* s);
- wstring_owner(wstring_owner& other) = delete;
- wstring_owner& operator=(wstring_owner& other) = delete;
- wstring_owner(wstring_owner&& other) noexcept;
- wstring_owner& operator=(wstring_owner&& other) noexcept;
+ static wchar_ptr from_narrow(const char* buf, int cp = CP_UTF8);
+ static wchar_ptr copy(const wchar_t* s);
+ wchar_ptr();
+ wchar_ptr(wchar_t* s);
+ wchar_ptr& operator=(wchar_t* s);
+ wchar_ptr(wchar_ptr& other) = delete;
+ wchar_ptr& operator=(wchar_ptr& other) = delete;
+ wchar_ptr(wchar_ptr&& other) noexcept;
+ wchar_ptr& operator=(wchar_ptr&& other) noexcept;
+ operator wchar_t*() noexcept;
wchar_t *release();
- operator bool() const;
- ~wstring_owner();
- wchar_t* p = nullptr;
+ ~wchar_ptr();
+private:
+ wchar_t* m_p = nullptr;
};
struct Win32Error : public std::exception