1- #ifndef xrstringH
2- #define xrstringH
31#pragma once
42
53// TODO: tamlin: Get rid of _std_extensions.h as compile-time dependency, if possible.
64#include " _types.h"
75#include " _std_extensions.h"
86
97#pragma pack(push, 4)
10- // ////////////////////////////////////////////////////////////////////////
11- // TODO: tamlin: Get rid of this blobal namespace polluting silly typedef.
12- typedef const char * str_c;
13-
14- // ////////////////////////////////////////////////////////////////////////
158#pragma warning(push)
169#pragma warning(disable : 4200)
1710struct XRCORE_API str_value
@@ -45,7 +38,7 @@ class XRCORE_API str_container
4538 str_container ();
4639 ~str_container ();
4740
48- str_value* dock (str_c value);
41+ str_value* dock (pcstr value);
4942 void clean ();
5043 void dump ();
5144 void dump (IWriter* W);
@@ -60,7 +53,6 @@ XRCORE_API extern str_container* g_pStringContainer;
6053// ////////////////////////////////////////////////////////////////////////
6154class shared_str
6255{
63- private:
6456 str_value* p_;
6557
6658protected:
@@ -75,7 +67,7 @@ class shared_str
7567 }
7668
7769public:
78- void _set (str_c rhs)
70+ void _set (pcstr rhs)
7971 {
8072 str_value* v = g_pStringContainer->dock (rhs);
8173 if (0 != v)
@@ -98,7 +90,7 @@ class shared_str
9890public:
9991 // construction
10092 shared_str () { p_ = 0 ; }
101- shared_str (str_c rhs)
93+ shared_str (pcstr rhs)
10294 {
10395 p_ = 0 ;
10496 _set (rhs);
@@ -110,7 +102,7 @@ class shared_str
110102 }
111103 ~shared_str () { _dec (); }
112104 // assignment & accessors
113- shared_str& operator =(str_c rhs)
105+ shared_str& operator =(pcstr rhs)
114106 {
115107 _set (rhs);
116108 return (shared_str&)*this ;
@@ -121,10 +113,10 @@ class shared_str
121113 return (shared_str&)*this ;
122114 }
123115 // XXX tamlin: Remove operator*(). It may be convenient, but it's dangerous. Use
124- str_c operator *() const { return p_ ? p_->value : 0 ; }
116+ pcstr operator *() const { return p_ ? p_->value : 0 ; }
125117 bool operator !() const { return p_ == 0 ; }
126118 char operator [](size_t id) { return p_->value [id]; }
127- str_c c_str () const { return p_ ? p_->value : 0 ; }
119+ pcstr c_str () const { return p_ ? p_->value : 0 ; }
128120 // misc func
129121 u32 size () const
130122 {
@@ -172,5 +164,3 @@ IC int xr_strcmp(const shared_str& a, const shared_str& b) throw()
172164void xr_strlwr (shared_str& src);
173165
174166#pragma pack(pop)
175-
176- #endif
0 commit comments