aboutsummaryrefslogtreecommitdiff
path: root/c/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/common.h')
-rw-r--r--c/common.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/c/common.h b/c/common.h
index 8b88635..7b7e996 100644
--- a/c/common.h
+++ b/c/common.h
@@ -11,7 +11,22 @@
#define WA "A"
#endif
-std::wstring WsFromSz(const char* sz, int iCp = CP_UTF8);
+struct wstring_owner
+{
+ wstring_owner();
+ wstring_owner(wchar_t* wsz);
+ wstring_owner& operator=(wchar_t* wsz);
+ wstring_owner(wstring_owner& wso) = delete;
+ wstring_owner& operator=(wstring_owner& wso) = delete;
+ wstring_owner(wstring_owner&& wso) noexcept;
+ wstring_owner& operator=(wstring_owner&& wso) noexcept;
+ wchar_t *release();
+ operator bool() const;
+ ~wstring_owner();
+ wchar_t* p = nullptr;
+};
+
+wstring_owner WsoFromSz(const char* sz, int iCp = CP_UTF8);
int EBMessageBox(const wchar_t* wszText, const wchar_t* wszCaption, unsigned uType);
struct Win32Error : public std::exception