#include <j2k/Fred/String/String.hpp>
Go to the source code of this file.
Functions | |
JString | operator+ (const JString &S1, const JString &S2) |
JString | operator+ (const JString &S1, const char *s2) |
JString | operator+ (const char *s1, const JString &S2) |
JString | operator+ (const JString &S1, char c) |
JString | operator+ (char c, const JString &S2) |
|
Definition at line 264 of file StrAdd.cpp. 00264 { 00265 JString* s = new JString(); // JStringData = &strNull 00266 char s1[2] = { c, '\0' }; 00267 00268 if ( c == '\0' || c == (char)NULL ) { // No addition needed 00269 s->pData = S2.pData; // s1 is NULL, assign S2 00270 } else if ( S2.pData == strNull ) { 00271 s->pData = new JStringData( c ); // Only s1 is not NULL 00272 } else { // Normal Addition, None are NULL 00273 s->Add( s1, S2.pData->data, 1, S2.pData->length ); 00274 } 00275 00276 assert( s->pData->data[s->pData->length] == '\0'); 00277 00278 return *s; 00279 } |
|
Definition at line 247 of file StrAdd.cpp. 00247 { 00248 JString* s = new JString(); // JStringData = &strNull 00249 char s2[2] = { c, '\0' }; 00250 00251 if ( c == '\0' || c == (char)NULL ) { // No addition needed 00252 s->pData = S1.pData; 00253 } else if ( S1.pData == strNull ) { 00254 s->pData = new JStringData( c ); // Only s2 is not NULL 00255 } else { // Normal Addition, None are NULL 00256 S1.pData->data[ S1.pData->length ] = '\0'; // Safety feature 00257 s->Add( S1.pData->data, s2, S1.pData->length, 1 ); 00258 } 00259 00260 assert( s->pData->data[s->pData->length] == '\0'); 00261 return *s; 00262 } |
|
Definition at line 230 of file StrAdd.cpp. 00230 { 00231 JString* s = new JString(); // JStringData = &strNull 00232 00233 if ( s1 == NULL || *s1 == (char)NULL ) { // No addition needed 00234 s->pData = S2.pData; // s1 is NULL, assign S2 00235 } else if ( S2.pData == strNull ) { 00236 s->pData = new JStringData( s1 ); // Only s1 is not NULL 00237 } else { // Normal Addition, None are NULL 00238 size_t Len = strlen( s1 ); 00239 s->Add( s1, S2.pData->data, Len, S2.pData->length ); 00240 } 00241 00242 assert( s->pData->data[s->pData->length] == '\0'); 00243 00244 return *s; 00245 } |
|
Definition at line 212 of file StrAdd.cpp. 00212 { 00213 JString* s = new JString(); // JStringData = &strNull 00214 00215 if ( s2 == NULL || *s2 == (char)NULL ) { // No addition needed 00216 s->pData = S1.pData; 00217 } else if ( S1.pData == strNull ) { 00218 s->pData = new JStringData( s2 ); // Only s2 is not NULL 00219 } else { // Normal Addition, None are NULL 00220 S1.pData->data[ S1.pData->length ] = '\0'; // Safety feature 00221 00222 size_t Len = strlen( s2 ); 00223 s->Add( S1.pData->data, s2, S1.pData->length, Len ); 00224 } 00225 00226 assert( s->pData->data[s->pData->length] == '\0'); 00227 return *s; 00228 } |
|
Definition at line 182 of file StrAdd.cpp. 00182 { 00183 JString* s = new JString(); // JStringData = &strNull 00184 00185 if ( S1.pData == strNull ) { 00186 // S1.pData->Dec(); // Not Needed, NO decrement on Null 00187 s->pData = S2.pData; // S1 is NULL, assign S2. 00188 00189 S2.pData->Inc(); 00190 00191 // Inc() & Dec() checks for strNull and don't increase or decrease it 00192 00193 } else if ( S2.pData == strNull ) { 00194 // S2.pData->Dec(); // Not Needed, NO decrement on Null 00195 s->pData = S1.pData; // S2 is NULL, assign S1. 00196 S1.pData->Inc(); 00197 } else { // Normal Addition, None are NULL 00198 00199 // Will change this == 's', 00200 // it works since 's' call it's own function ! 00201 S1.pData->data[ S1.pData->length ] = '\0'; // Safety feature 00202 S2.pData->data[ S2.pData->length ] = '\0'; // Safety feature 00203 00204 s->Add( S1.pData->data, S2.pData->data, 00205 S1.pData->length, S2.pData->length ); 00206 } 00207 00208 assert( s->pData->data[s->pData->length] == '\0'); 00209 return *s; 00210 } |