Changeset 127 for pjproject/trunk/pjlib/include/pj++/string.hpp
- Timestamp:
- Jan 30, 2006 6:40:05 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/include/pj++/string.hpp
r122 r127 41 41 42 42 // 43 // Construct the buffer from a char* .44 // 45 explicitPj_String(char *str)43 // Construct the buffer from a char* (use with care) 44 // 45 Pj_String(char *str) 46 46 { 47 47 set(str); … … 51 51 // Construct from a const char*. 52 52 // 53 Pj_String(Pj_Pool *pool, const char *src)53 Pj_String(Pj_Pool &pool, const char *src) 54 54 { 55 55 set(pool, src); … … 57 57 58 58 // 59 // Construct from pj_str_t*. 60 // 61 explicit Pj_String(pj_str_t *s) 62 { 63 set(s); 59 // Construct from pj_str_t&. 60 // 61 explicit Pj_String(pj_str_t &s) 62 { 63 ptr = s.ptr; 64 slen = s.slen; 65 } 66 67 // 68 // Construct from const pj_str_t& (use with care!). 69 // 70 explicit Pj_String(const pj_str_t &s) 71 { 72 ptr = (char*)s.ptr; 73 slen = s.slen; 64 74 } 65 75 … … 67 77 // Construct by copying from const pj_str_t*. 68 78 // 69 Pj_String(Pj_Pool *pool, const pj_str_t *s)79 Pj_String(Pj_Pool &pool, const pj_str_t *s) 70 80 { 71 81 set(pool, s); … … 73 83 74 84 // 75 // Construct from another Pj_String76 //77 explicit Pj_String(Pj_String &rhs)78 {79 set(rhs);80 }81 82 //83 85 // Construct by copying from Pj_String 84 86 // 85 Pj_String(Pj_Pool *pool, const Pj_String &rhs)87 Pj_String(Pj_Pool &pool, const Pj_String &rhs) 86 88 { 87 89 set(pool, rhs); … … 89 91 90 92 // 93 // Construct from another Pj_String, use with care! 94 // 95 explicit Pj_String(const Pj_String &rhs) 96 { 97 ptr = rhs.ptr; 98 slen = rhs.slen; 99 } 100 101 // 91 102 // Construct from a char* and a length. 92 103 // … … 105 116 106 117 // 118 // You can cast Pj_String to pj_str_t* 119 // 120 operator pj_str_t*() 121 { 122 return this; 123 } 124 125 // 126 // You can cast const Pj_String to const pj_str_t* 127 // 128 operator const pj_str_t*() const 129 { 130 return this; 131 } 132 133 // 107 134 // Get the length of the string. 108 135 // … … 139 166 // Initialize by copying from a const char*. 140 167 // 141 void set(Pj_Pool *pool, const char *s)142 { 143 pj_strdup2(pool ->pool_(), this, s);168 void set(Pj_Pool &pool, const char *s) 169 { 170 pj_strdup2(pool, this, s); 144 171 } 145 172 … … 155 182 // Initialize by copying from const pj_str_t*. 156 183 // 157 void set(Pj_Pool *pool, const pj_str_t *s)158 { 159 pj_strdup(pool ->pool_(), this, s);184 void set(Pj_Pool &pool, const pj_str_t *s) 185 { 186 pj_strdup(pool, this, s); 160 187 } 161 188 … … 187 214 // Initialize by copying from a Pj_String*. 188 215 // 189 void set(Pj_Pool *pool, const Pj_String *s)190 { 191 pj_strdup(pool ->pool_(), this, s);216 void set(Pj_Pool &pool, const Pj_String *s) 217 { 218 pj_strdup(pool, this, s); 192 219 } 193 220 … … 195 222 // Initialize by copying from other Pj_String. 196 223 // 197 void set(Pj_Pool *pool, const Pj_String &s)198 { 199 pj_strdup(pool ->pool_(), this, &s);224 void set(Pj_Pool &pool, const Pj_String &s) 225 { 226 pj_strdup(pool, this, &s); 200 227 } 201 228 … … 354 381 355 382 /// 356 // Assign from another Pj_String 357 // 358 Pj_String& operator=(Pj_String &rhs) 359 { 360 set(rhs); 383 // Assign from another Pj_String, use with care! 384 // 385 Pj_String& operator=(const Pj_String &rhs) 386 { 387 ptr = rhs.ptr; 388 slen = rhs.slen; 361 389 return *this; 362 390 }
Note: See TracChangeset
for help on using the changeset viewer.