diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/string/playstring.cpp | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Wasabi/bfc/string/playstring.cpp')
-rw-r--r-- | Src/Wasabi/bfc/string/playstring.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/string/playstring.cpp b/Src/Wasabi/bfc/string/playstring.cpp new file mode 100644 index 00000000..88583265 --- /dev/null +++ b/Src/Wasabi/bfc/string/playstring.cpp @@ -0,0 +1,57 @@ +#include "precomp_wasabi_bfc.h" + +#include "playstring.h" + +#define USE_TABLE + +Playstring::Playstring(const wchar_t *_val) { + val = NULL; + setValue(_val); +} + +Playstring::Playstring(const Playstring &ps) { + val = NULL; + setValue(ps.getValue()); +} + +Playstring::~Playstring() { + setValue(NULL); +} + +void Playstring::setValue(const wchar_t *newval) { + _setValue(newval, 0); +} + +void Playstring::_setValue(const wchar_t *newval, int tablenum) +{ +#ifdef USE_TABLE +#ifdef WASABI_COMPILE_METADB + if (val != NULL) WASABI_API_METADB->metadb_releasePlaystring(val, tablenum); +#else + FREE((void*)val); +#endif +#else + FREE((void*)val); +#endif + + val = NULL; + + if (newval != NULL /*&& *newval != 0*/) { +#ifdef USE_TABLE +#ifdef WASABI_COMPILE_METADB + val = WASABI_API_METADB->metadb_dupPlaystring(newval, tablenum); +#else + val = WCSDUP(newval); +#endif +#else + val = STRDUP(newval); +#endif + } +} + +Playstring& Playstring::operator =(const Playstring &ps) { + if (this != &ps) { + setValue(ps.getValue()); + } + return *this; +} |