aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/bfc/string/playstring.h
blob: 2e9b183f7b31484156f49373c047689d624113bf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef _PLAYSTRING_H
#define _PLAYSTRING_H

#include <bfc/common.h>
#include <bfc/string/StringW.h>

class Playstring 
{
public:
  Playstring(const wchar_t *val=NULL);
  Playstring(const Playstring &ps);
  ~Playstring();

  const wchar_t *getValue() const { return val; }
  operator const wchar_t *() const { return getValue(); }

  void setValue(const wchar_t *newval);

  // copy
  Playstring& operator =(const Playstring &ps);

protected:
  void _setValue(const wchar_t *newval, int tablenum);

private:
  const wchar_t *val;
};

class PlaystringComparator {
public:
  // comparator for sorting
  static int compareItem(Playstring *p1, Playstring* p2) {
    return wcscmp(p1->getValue(), p2->getValue());
  }
};

template <int tablenum=0>
class PlaystringT : public Playstring {
public:
  PlaystringT(const wchar_t *newval) {
    val = NULL; setValue(newval);
  }
  PlaystringT(const Playstring &ps) {
    val = NULL; setValue(ps.getValue());
  }
  void setValue(const wchar_t *newval) { _setValue(newval, tablenum); }
};

#endif