diff options
Diffstat (limited to 'c/wcharptr.cpp')
-rw-r--r-- | c/wcharptr.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/c/wcharptr.cpp b/c/wcharptr.cpp index e406ed1..240fff5 100644 --- a/c/wcharptr.cpp +++ b/c/wcharptr.cpp @@ -4,11 +4,11 @@ #include "wcharptr.h" #include "win.h" -wchar_ptr::wchar_ptr() noexcept {} +WcharPtr::WcharPtr() noexcept {} -wchar_ptr::wchar_ptr(wchar_t* const s) noexcept : m_p(s) {} +WcharPtr::WcharPtr(wchar_t* const s) noexcept : m_p(s) {} -wchar_ptr& wchar_ptr::operator=(wchar_t* const s) noexcept +WcharPtr& WcharPtr::operator=(wchar_t* const s) noexcept { if (m_p != s) { delete m_p; @@ -17,33 +17,33 @@ wchar_ptr& wchar_ptr::operator=(wchar_t* const s) noexcept return *this; } -wchar_ptr::wchar_ptr(wchar_ptr&& other) noexcept +WcharPtr::WcharPtr(WcharPtr&& other) noexcept : m_p(std::exchange(other.m_p, nullptr)) {} -wchar_ptr& wchar_ptr::operator=(wchar_ptr&& other) noexcept +WcharPtr& WcharPtr::operator=(WcharPtr&& other) noexcept { std::swap(m_p, other.m_p); return *this; } -wchar_ptr::operator wchar_t*() noexcept +WcharPtr::operator wchar_t*() noexcept { return m_p; } -wchar_t* wchar_ptr::release() noexcept +wchar_t* WcharPtr::Release() noexcept { wchar_t* p2 = m_p; m_p = nullptr; return p2; } -wchar_ptr::~wchar_ptr() noexcept +WcharPtr::~WcharPtr() noexcept { delete m_p; } -wchar_ptr wchar_ptr::from_narrow(const char* const src, const int cp) +WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp) { int cbMultiByte = strlen(src)+1; int cchWideChar = MultiByteToWideChar(cp, 0, src, cbMultiByte, NULL, 0); @@ -55,7 +55,7 @@ wchar_ptr wchar_ptr::from_narrow(const char* const src, const int cp) return dst; } -wchar_ptr wchar_ptr::copy(const wchar_t* const src) +WcharPtr WcharPtr::Copy(const wchar_t* const src) { const int cb = wcslen(src)+1; wchar_t* dst = new wchar_t[cb]; |