diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-24 15:17:08 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-24 15:17:33 +0200 |
commit | 6fd66a9264731bd7ee6d7602675965021d929a4a (patch) | |
tree | e94fc63efb823ad2f5c9ef6de6188da389a08d38 /c/wcharptr.cpp | |
parent | ff48d644a45dd71098ecb9007a41807fb37d0081 (diff) | |
download | EpisodeBrowser-6fd66a9264731bd7ee6d7602675965021d929a4a.tar.gz |
Remove Prolog dependency.
The only thing left to reimplement is the tracking of watched episodes
in MPC-HC.
Diffstat (limited to 'c/wcharptr.cpp')
-rw-r--r-- | c/wcharptr.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/c/wcharptr.cpp b/c/wcharptr.cpp deleted file mode 100644 index f659767..0000000 --- a/c/wcharptr.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include <utility> -#include <windows.h> - -#include "wcharptr.h" -#include "win.h" - -WcharPtr WcharPtr::FromNarrow(const char* const src, const int cp) -{ - int cchNarrow = strlen(src)+1; - int cchWide = MultiByteToWideChar(cp, 0, src, cchNarrow, nullptr, 0); - wchar_t* dst = new wchar_t[cchWide]; - if (!MultiByteToWideChar(cp, 0, src, cchNarrow, dst, cchWide)) { - delete dst; - throw Win32Error(); - } - return dst; -} - -WcharPtr WcharPtr::Copy(const wchar_t* const src) -{ - const int cch = wcslen(src)+1; - wchar_t* dst = new wchar_t[cch]; - memcpy(dst, src, cch*sizeof(wchar_t)); - return dst; -} - -WcharPtr::WcharPtr() noexcept {} - -WcharPtr::~WcharPtr() noexcept -{ - delete m_p; -} - -WcharPtr::operator wchar_t*() noexcept -{ - return m_p; -} - -WcharPtr::WcharPtr(wchar_t* const s) noexcept : m_p(s) {} - -WcharPtr& WcharPtr::operator=(wchar_t* const s) noexcept -{ - if (m_p != s) { - delete m_p; - m_p = s; - } - return *this; -} - -WcharPtr::WcharPtr(WcharPtr&& other) noexcept - : m_p(std::exchange(other.m_p, nullptr)) {} - -WcharPtr& WcharPtr::operator=(WcharPtr&& other) noexcept -{ - std::swap(m_p, other.m_p); - return *this; -} - -wchar_t* WcharPtr::Release() noexcept -{ - wchar_t* const p = m_p; - m_p = nullptr; - return p; -} |