1
0

playstring.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "precomp_wasabi_bfc.h"
  2. #include "playstring.h"
  3. #define USE_TABLE
  4. Playstring::Playstring(const wchar_t *_val) {
  5. val = NULL;
  6. setValue(_val);
  7. }
  8. Playstring::Playstring(const Playstring &ps) {
  9. val = NULL;
  10. setValue(ps.getValue());
  11. }
  12. Playstring::~Playstring() {
  13. setValue(NULL);
  14. }
  15. void Playstring::setValue(const wchar_t *newval) {
  16. _setValue(newval, 0);
  17. }
  18. void Playstring::_setValue(const wchar_t *newval, int tablenum)
  19. {
  20. #ifdef USE_TABLE
  21. #ifdef WASABI_COMPILE_METADB
  22. if (val != NULL) WASABI_API_METADB->metadb_releasePlaystring(val, tablenum);
  23. #else
  24. FREE((void*)val);
  25. #endif
  26. #else
  27. FREE((void*)val);
  28. #endif
  29. val = NULL;
  30. if (newval != NULL /*&& *newval != 0*/) {
  31. #ifdef USE_TABLE
  32. #ifdef WASABI_COMPILE_METADB
  33. val = WASABI_API_METADB->metadb_dupPlaystring(newval, tablenum);
  34. #else
  35. val = WCSDUP(newval);
  36. #endif
  37. #else
  38. val = STRDUP(newval);
  39. #endif
  40. }
  41. }
  42. Playstring& Playstring::operator =(const Playstring &ps) {
  43. if (this != &ps) {
  44. setValue(ps.getValue());
  45. }
  46. return *this;
  47. }