add support to SDLBackend for rendering 24bit data
[openc2e.git] / shared_str.h
bloba1078b7b040155b14b8f64df86b61b04ce233cb6
1 #ifndef SHARED_STR_H
2 #define SHARED_STR_H 1
4 class shared_str_b {
5 FRIEND_SERIALIZE(shared_str_b)
6 protected:
7 std::string s;
8 public:
9 std::string &operator*() { return s; }
10 const std::string &operator*() const { return s; }
11 shared_str_b() { }
12 shared_str_b(const std::string &p) : s(p) { }
15 class shared_str {
16 FRIEND_SERIALIZE(shared_str)
17 protected:
18 boost::shared_ptr<shared_str_b> p;
19 public:
20 shared_str() : p(new shared_str_b()) { }
21 shared_str(const shared_str &v) : p(v.p) { }
22 shared_str(const std::string &p) : p(new shared_str_b(p)) { }
24 std::string &operator*() { return **p; }
25 const std::string &operator*() const { return **p; }
26 std::string *operator->() { return &(**this); }
27 const std::string *operator->() const { return &(**this); }
30 #endif