00001 #ifndef _RSTRING_HXX_
00002 #define _RSTRING_HXX_
00003
00004 #include <string>
00005
00006 #include <rglobals.hxx>
00007
00008 namespace RayGina
00009 {
00010 namespace CORE
00011 {
00012 class RString {
00013
00014 private:
00015 RUInt _length;
00016 RChar* _text;
00017
00019 inline RChar* getTextPointer(const RUInt index = 0) const {
00020 return &_text[index];
00021 }
00022
00024 inline void initConstChar(const char* const_string) {
00025 if(NULL == const_string) {
00026 setLength(1);
00027 _text[0] = '0';
00028 return;
00029 }
00031 RUInt counter = 1;
00032 while(0 != counter) {
00033 if(0 == const_string[counter-1]) {
00034 break;
00035 }
00036 counter++;
00037 }
00038
00039 if(2 > counter) {
00040 #ifdef RAYGINADEBUG
00041 if(0 == counter) {
00042 printf("RString: To big const char* for RString! More than 2^64 characters!\n");
00043 exit(-1);
00044 }
00045 #endif
00046 _length = 0;
00047 _text = NULL;
00048 } else {
00049 _length = counter - 1;
00050 _text = new RChar[_length + 1];
00051 if(NULL == _text) {
00052 #ifdef RAYGINADEBUG
00053 printf("RString: No enough memory to allocate %d characters\n",_length);
00054 exit(-1);
00055 #endif
00056 _length = 0;
00057 } else {
00058 for(RUInt i = 0; i < length() ; i++) {
00059 _text[i] = const_string[i];
00060 }
00061 _text[_length] = 0;
00062 }
00063 }
00064 }
00065
00067 inline void initRString(const RString &oldString) {
00068 _length = oldString.length();
00069 if(0 != _length) {
00070 _text = new RChar[_length+1];
00071 if(NULL != _text) {
00072 for(RUInt i = 0; i < _length ; i++) {
00073 _text[i] = oldString.getCharacter(i);
00074 }
00075
00076 _text[_length] = 0;
00077 #ifdef RAYGINADEBUG
00078 } else {
00079 printf("No memory for allocating a string with length %d",_length);
00080 exit(-1);
00081 #endif
00082 }
00083 } else {
00084 _text = NULL;
00085 }
00086 }
00087
00088
00089 const bool setLength(const RUInt newLength) {
00090 if(NULL != _text) {
00091 delete[] _text;
00092 _text = NULL;
00093 }
00094
00095 _text = new RChar[newLength + 1];
00096 if(NULL == _text) {
00097 _length = 0;
00098 return false;
00099 }
00100
00101 _text[0] = 0;
00102 _length = newLength;
00103 return true;
00104 }
00105
00106
00107 public:
00109 inline RString() : _length(0),_text(NULL) {};
00110
00112 inline ~RString() {
00113 if(NULL != _text) delete[] _text;
00114 };
00115
00117 inline RString(const RString &oldString) {
00118 initRString(oldString);
00119 }
00120
00122 inline RString(const char* const_string) {
00123 initConstChar(const_string);
00124 }
00125
00126 inline RString(const RChar* text,RUInt newLength) {
00127 if(newLength == 0) {
00128 _text = NULL;
00129 _length = 0;
00130 }
00131
00132 _text = new RChar[newLength + 1];
00133 for(RUInt i = 0 ; i < newLength ; i++) {
00134 _text[i] = text[i];
00135 }
00136
00137 _text[newLength] = 0;
00138 _length = newLength;
00139 }
00140
00141 inline RString(const char chr) {
00142 _length = 1;
00143 _text = new RChar[2];
00144 if(NULL == _text) {
00145 #ifdef RAYGINADEBUG
00146 printf("Not enough memort to allocate TWO byte?!?!?!?\nExiting!\n");
00147 exit(-1);
00148 #endif
00149 _length = 0;
00150 } else {
00151 _text[0] = chr;
00152 _text[1] = 0;
00153 }
00154 }
00155
00156 inline RString(const RInt value,const unsigned int base = 10) {
00157 if(0 == value) {
00158 setLength(1);
00159 _text[0] = '0';
00160 return;
00161 }
00162 RChar tmp[128];
00163 tmp[127] = 0;
00164 RUInt32 counter = 126;
00165 RInt tmp_value;
00166 if(value < 0) {
00167 tmp_value = 0 - value;
00168 } else {
00169 tmp_value = value;
00170 }
00171 while(0 != tmp_value) {
00172 switch(tmp_value % base) {
00173 default:
00174 tmp[counter] = '0';
00175 break;
00176 case 1:
00177 tmp[counter] = '1';
00178 break;
00179 case 2:
00180 tmp[counter] = '2';
00181 break;
00182 case 3:
00183 tmp[counter] = '3';
00184 break;
00185 case 4:
00186 tmp[counter] = '4';
00187 break;
00188 case 5:
00189 tmp[counter] = '5';
00190 break;
00191 case 6:
00192 tmp[counter] = '6';
00193 break;
00194 case 7:
00195 tmp[counter] = '7';
00196 break;
00197 case 8:
00198 tmp[counter] = '8';
00199 break;
00200 case 9:
00201 tmp[counter] = '9';
00202 break;
00203 case 10:
00204 tmp[counter] = 'a';
00205 break;
00206 case 11:
00207 tmp[counter] = 'b';
00208 break;
00209 case 12:
00210 tmp[counter] = 'c';
00211 break;
00212 case 13:
00213 tmp[counter] = 'd';
00214 break;
00215 case 14:
00216 tmp[counter] = 'e';
00217 break;
00218 case 15:
00219 tmp[counter] = 'f';
00220 break;
00221 }
00222 counter--;
00223
00224 tmp_value = tmp_value / base;
00225 }
00226
00227 if(value < 0) {
00228 tmp[counter] = '-';
00229 counter--;
00230 }
00231
00232 _length = 126 - counter;
00233 _text = new RChar[_length];
00234 for(RUInt32 i = 0 ; i <= _length ; i++) {
00235 counter++;
00236 _text[i] = tmp[counter];
00237 }
00238 }
00239
00240 inline RString(const RUInt value,const unsigned int base = 10) {
00241 RChar tmp[128];
00242 tmp[127] = 0;
00243 RUInt32 counter = 126;
00244 RUInt tmp_value = value;
00245 while(0 != tmp_value) {
00246 switch(tmp_value % base) {
00247 default:
00248 tmp[counter] = '0';
00249 break;
00250 case 1:
00251 tmp[counter] = '1';
00252 break;
00253 case 2:
00254 tmp[counter] = '2';
00255 break;
00256 case 3:
00257 tmp[counter] = '3';
00258 break;
00259 case 4:
00260 tmp[counter] = '4';
00261 break;
00262 case 5:
00263 tmp[counter] = '5';
00264 break;
00265 case 6:
00266 tmp[counter] = '6';
00267 break;
00268 case 7:
00269 tmp[counter] = '7';
00270 break;
00271 case 8:
00272 tmp[counter] = '8';
00273 break;
00274 case 9:
00275 tmp[counter] = '9';
00276 break;
00277 case 10:
00278 tmp[counter] = 'a';
00279 break;
00280 case 11:
00281 tmp[counter] = 'b';
00282 break;
00283 case 12:
00284 tmp[counter] = 'c';
00285 break;
00286 case 13:
00287 tmp[counter] = 'd';
00288 break;
00289 case 14:
00290 tmp[counter] = 'e';
00291 break;
00292 case 15:
00293 tmp[counter] = 'f';
00294 break;
00295 }
00296 counter--;
00297
00298 tmp_value = tmp_value / base;
00299 }
00300
00301 _length = 126 - counter;
00302 _text = new RChar[_length];
00303 for(RUInt32 i = 0 ; i <= _length ; i++) {
00304 counter++;
00305 _text[i] = tmp[counter];
00306 }
00307 }
00308
00309 inline RString(const double value,const RUInt32 afterCommaDigits = 8) {
00310 char tmp[120];
00311 sprintf(tmp,"%.*f",afterCommaDigits,value);
00312 initConstChar(tmp);
00313 }
00314
00316 inline const RUInt length() const {
00317 return _length;
00318 }
00319
00321
00326 inline const RChar getCharacter(const RUInt n) const {
00327 #ifdef RAYGINADEBUG
00328 if(n >= length()) {
00329 printf("RString::getCharacter: n(%d) is bigger than the string length (%d). Quitting!\n",n,length());
00330 exit(-1);
00331 }
00332 #endif
00333 return _text[n];
00334 }
00335
00337
00342 inline void setCharacter(const RUInt n,const RChar newChar) const {
00343 #ifdef RAYGINADEBUG
00344 if(n >= length()) {
00345 printf("RString::setCharacter: n(%d) is bigger than the string length (%d). Quitting!\n",n,length());
00346 exit(-1);
00347 }
00348 #endif
00349 _text[n] = newChar;
00350 }
00351
00352 inline const RChar operator[](RUInt n) const {
00353 #ifdef RAYGINADEBUG
00354 if(n >= length()) {
00355 printf("RString::getCharacter: n(%d) is bigger than the string length (%d). Quitting!\n",n,length());
00356 exit(-1);
00357 }
00358 #endif
00359 return _text[n];
00360 }
00361
00362 inline const RChar at(RUInt n) const {
00363 #ifdef RAYGINADEBUG
00364 if(n >= length()) {
00365 printf("RString::getCharacter: n(%d) is bigger than the string length (%d). Quitting!\n",n,length());
00366 exit(-1);
00367 }
00368 #endif
00369 return _text[n];
00370 }
00371
00372 inline void operator=(const RString& b) {
00373 if(NULL != _text) delete[] _text;
00374 initRString(b);
00375 }
00376
00377 inline void operator+=(const RString& b) {
00378
00379 if(0 == b.length()) return;
00380
00381
00382 RChar* newText = new RChar[length() + b.length() + 1];
00383 if(NULL != _text) {
00384
00385 for(RUInt i = 0 ; i < length(); i++) {
00386 newText[i] = _text[i];
00387 }
00388 delete[] _text;
00389 }
00390
00391 _text = newText;
00392
00393 for(RUInt i = 0 ; i < b.length(); i++) {
00394 newText[length() + i] = b.getTextPointer()[i];
00395 }
00396
00397 _text[length() + b.length()] = 0;
00398
00399 _length += b.length();
00400 }
00401
00402 inline void operator+=(const int b) {
00403 (*this) += RString(b);
00404 }
00405
00406 inline void operator+=(const double b) {
00407 (*this) += RString(b);
00408 }
00409
00410 inline const RBool empty() const {
00411 return (0 == length());
00412 }
00413
00414 inline const RUInt c_length() const {
00415 return length() + 1;
00416 }
00417 inline const char* c_str() const {
00418 return getTextPointer();
00419 }
00420
00421 inline const RUInt substr(const RUInt sstart,const RUInt slength = 0) {
00422 RUInt start = sstart;
00423 RUInt end = start + slength;
00424 if((0 == slength) || (end > length())) {
00425 end = length();
00426 }
00427
00428 if((0 == end) || (start >= end)) {
00429 if(NULL != _text) {
00430 delete[] _text;
00431 _text = NULL;
00432 }
00433 _length = 0;
00434 return 0;
00435 }
00436
00437 RUInt newLength = end - start;
00438 RChar* tmp = new RChar[newLength + 1];
00439
00440 RUInt i = 0;
00441 while(start < end) {
00442 tmp[i] = _text[start];
00443 start++;
00444 i++;
00445 }
00446 tmp[i] = 0;
00447
00448 delete[] _text;
00449 _text = tmp;
00450 _length = newLength;
00451
00452 return length();
00453 }
00454
00455 inline RString getSubstr(const RUInt sstart,const RUInt slength = 0) const {
00456 RUInt start = sstart;
00457 RUInt end = start + slength;
00458 if((0 == slength) || (end > length())) {
00459 end = length();
00460 }
00461
00462 if((0 == end) || (start >= end)) return RString();
00463
00464 return RString(getTextPointer(start),end-start);
00465 }
00466
00467 inline const RInt find_last_of(const RString search_string) const {
00468 if((0 == search_string.length()) || (0 == length())) return -1;
00469
00470 RInt result = length() - 1;
00471 while(result >= 0) {
00472 for(RUInt i = 0; i < search_string.length() ; i++) {
00473 if(search_string[i] == _text[result]) return result;
00474 }
00475 result--;
00476 }
00477 return -1;
00478 }
00479
00480 inline const RInt find_last_not_of(const RString search_string) const {
00481 if((0 == search_string.length()) || (0 == length())) return -1;
00482
00483 RInt result = length() - 1;
00484 while(result >= 0) {
00485 RBool tester = false;
00486 for(RUInt i = 0; i < search_string.length() ; i++) {
00487 tester |= search_string[i] == _text[result];
00488 }
00489 if(false == tester) return result;
00490 result--;
00491 }
00492 return -1;
00493 }
00494
00495 inline const RInt find_first_of(const RString search_string) const {
00496 if((0 == search_string.length()) || (0 == length())) return -1;
00497
00498 RUInt result = 0;
00499 while(result < length()) {
00500 for(RUInt i = 0; i < search_string.length() ; i++) {
00501 if(search_string[i] == _text[result]) return result;
00502 }
00503 result++;
00504 }
00505 return -1;
00506 }
00507
00508 inline const RInt find_first_not_of(const RString search_string) const {
00509 if((0 == search_string.length()) || (0 == length())) return -1;
00510
00511 RUInt result = 0;
00512 while(result < length()) {
00513 RBool tester = false;
00514 for(RUInt i = 0; i < search_string.length() ; i++) {
00515 tester |= search_string[i] == _text[result];
00516 }
00517 if(false == tester) return result;
00518 result++;
00519 }
00520 return -1;
00521 }
00522
00523 inline const RInt find(const RString search_string,const RUInt startPos = 0) {
00524 if((0 == search_string.length()) || (0 == length()) || (startPos >= length())) return -1;
00525
00526 RUInt i = startPos;
00527 RUInt j = 0;
00528 while(i < length()) {
00529 if(_text[i] == search_string[j]) {
00530 j++;
00531 i++;
00532 if(j == search_string.length()) {
00533 return i - search_string.length();
00534 }
00535 } else {
00536 j=0;
00537 i++;
00538 }
00539 }
00540 return -1;
00541 }
00542
00543 inline const RInt rfind(const RString search_string,const RUInt startPos = 0) {
00544 if((0 == search_string.length()) || (0 == length()) || (startPos >= length())) return -1;
00545
00546 RUInt i = startPos;
00547 if(0 == i) i = length();
00548
00549 RUInt j = search_string.length() - 1;
00550 while(true) {
00551 i--;
00552
00553 if(_text[i] == search_string[j]) {
00554 if(0 == j) {
00555 return i;
00556 }
00557 j--;
00558 } else {
00559 j=search_string.length() - 1;
00560 }
00561 if(0 == i) return -1;
00562 }
00563 return -1;
00564 }
00565
00566 inline const RUInt erase(const RUInt startPos = 0,const RUInt numberOfCharacters = 0) {
00567 RUInt start = startPos;
00568 RUInt end = start + numberOfCharacters;
00569 if((0 == numberOfCharacters) || (end > length())) {
00570 end = length();
00571 }
00572
00573 if((0 == end) || (start >= end)) return 0;
00574
00575 RUInt newLength = length() - end + start;
00576 if(0 == newLength) {
00577 newLength = length();
00578 _length = 0;
00579 delete[] _text;
00580 _text = NULL;
00581 return newLength;
00582 }
00583 RChar* tmp = new RChar[newLength + 1];
00584
00585 RUInt i = 0;
00586 while(i < start) {
00587 tmp[i] = _text[i];
00588 i++;
00589 }
00590 while(end < length()) {
00591 tmp[i] = _text[end];
00592 i++;
00593 end++;
00594 }
00595 tmp[i] = 0;
00596
00597 start = length() - newLength;
00598 delete[] _text;
00599 _text = tmp;
00600 _length = newLength;
00601
00602 return start;
00603 }
00604
00605 inline const RUInt toLowercase(const RUInt startPos = 0,const RUInt numberOfCharacters = 0) {
00606 RUInt copyLength = numberOfCharacters;
00607 if(0 == numberOfCharacters) {
00608 copyLength = length();
00609 }
00610
00611 if(startPos > length()) return 0;
00612
00613 if((startPos + copyLength) > length()) {
00614 copyLength = length() - startPos;
00615 }
00616
00617 if(0 == copyLength) return 0;
00618
00619 for(RUInt i = startPos; i < (startPos + copyLength) ; i++) {
00620 if((_text[i] > 64) && (_text[i] < 91)) _text[i] += 32;
00621 }
00622 return copyLength;
00623 }
00624
00625 inline const RString getToLowercase(const RUInt startPos = 0,const RUInt numberOfCharacters = 0) const {
00626 RString result(getTextPointer(),length());
00627 result.toLowercase(startPos,numberOfCharacters);
00628 return result;
00629 }
00630
00631 inline const RUInt toUppercase(const RUInt startPos = 0,const RUInt numberOfCharacters = 0) {
00632 RUInt copyLength = numberOfCharacters;
00633 if(0 == numberOfCharacters) {
00634 copyLength = length();
00635 }
00636
00637 if(startPos > length()) return 0;
00638
00639 if((startPos + copyLength) > length()) {
00640 copyLength = length() - startPos;
00641 }
00642
00643 if(0 == copyLength) return 0;
00644
00645 for(RUInt i = startPos; i < (startPos + copyLength) ; i++) {
00646 if((_text[i] > 96) && (_text[i] < 123)) _text[i] -= 32;
00647 }
00648
00649 return copyLength;
00650 }
00651 inline const RString getToUppercase(const RUInt startPos = 0,const RUInt numberOfCharacters = 0) const {
00652 RString result(getTextPointer(),length());
00653 result.toUppercase(startPos,numberOfCharacters);
00654 return result;
00655 }
00656
00657 inline void print() const {
00658 if(0 != length()) {
00659 printf("%s",c_str());
00660 }
00661 }
00662 inline void println() const {
00663 print();
00664 printf("\n");
00665 }
00666
00667
00668 inline const RUInt ltrim(const RString charlist = RString(" \t\n\r\0\x0B",6)) {
00669 if(0 == length()) return 0;
00670 if(0 == charlist.length()) return 0;
00671
00672 RUInt i;
00673 for(i = 0 ; i < length() ; i++) {
00674 RBool found = false;
00675 for(RUInt j = 0; j < charlist.length() ; j++) {
00676 if(charlist[j] == _text[i]) {
00677 found = true;
00678 break;
00679 }
00680 }
00681 if(false == found) {
00682 break;
00683 }
00684 }
00685
00686 if(i == length()) return erase();
00687
00688 RUInt tmpLength = length();
00689 return tmpLength - substr(i);
00690 }
00691
00692 inline const RUInt rtrim(const RString charlist = RString(" \t\n\r\0\x0B",6)) {
00693 if(0 == length()) return 0;
00694 if(0 == charlist.length()) return 0;
00695
00696 RUInt i;
00697 for(i = (length() - 1) ; ; i--) {
00698 RBool found = false;
00699 for(RUInt j = 0; j < charlist.length() ; j++) {
00700 if(charlist[j] == _text[i]) {
00701 found = true;
00702 break;
00703 }
00704 }
00705 if((false == found) || (0 == i)) {
00706 break;
00707 }
00708 }
00709
00710 if(0 == i) return erase();
00711
00712 RUInt tmpLength = length();
00713 return tmpLength - substr(0,i+1);
00714 }
00715
00716 inline const RUInt trim(const RString charlist = RString(" \t\n\r\0\x0B",6)) {
00717 if(0 == length()) return 0;
00718 if(0 == charlist.length()) return 0;
00719
00720 RUInt start;
00721 for(start = 0 ; start < length() ; start++) {
00722 RBool found = false;
00723 for(RUInt j = 0; j < charlist.length() ; j++) {
00724 if(charlist[j] == _text[start]) {
00725 found = true;
00726 break;
00727 }
00728 }
00729 if(false == found) {
00730 break;
00731 }
00732 }
00733
00734 if(start == length()) return erase();
00735
00736 RUInt end;
00737 for(end = (length() - 1) ; ; end--) {
00738 RBool found = false;
00739 for(RUInt j = 0; j < charlist.length() ; j++) {
00740 if(charlist[j] == _text[end]) {
00741 found = true;
00742 break;
00743 }
00744 }
00745 if((false == found) || (0 == end)) {
00746 break;
00747 }
00748 }
00749
00750 RUInt tmpLength = length();
00751 return tmpLength - substr(start,(end+1)-start);
00752 }
00753
00754 inline const RString getLtrim(const RString charlist = RString(" \t\n\r\0\x0B",6)) const {
00755 if(0 == length()) return "";
00756 if(0 == charlist.length()) return 0;
00757
00758 RUInt i;
00759 for(i = 0 ; i < length() ; i++) {
00760 RBool found = false;
00761 for(RUInt j = 0; j < charlist.length() ; j++) {
00762 if(charlist[j] == _text[i]) {
00763 found = true;
00764 break;
00765 }
00766 }
00767 if(false == found) {
00768 break;
00769 }
00770 }
00771
00772 if(i == length()) return "";
00773
00774 return RString(getTextPointer(i),length() - i);
00775 }
00776
00777 inline const RString getRtrim(const RString charlist = RString(" \t\n\r\0\x0B",6)) const {
00778 if(0 == length()) return "";
00779 if(0 == charlist.length()) return 0;
00780
00781 RUInt i;
00782 for(i = (length() - 1) ; ; i--) {
00783 RBool found = false;
00784 for(RUInt j = 0; j < charlist.length() ; j++) {
00785 if(charlist[j] == _text[i]) {
00786 found = true;
00787 break;
00788 }
00789 }
00790 if((false == found) || (0 == i)) {
00791 break;
00792 }
00793 }
00794
00795 if(0 == i) return "";
00796
00797 return RString(getTextPointer(),i+1);
00798 }
00799
00800 inline const RString getTrim(const RString charlist = RString(" \t\n\r\0\x0B",6)) const {
00801 if(0 == length()) return "";
00802 if(0 == charlist.length()) return 0;
00803
00804 RUInt start;
00805 for(start = 0 ; start < length() ; start++) {
00806 RBool found = false;
00807 for(RUInt j = 0; j < charlist.length() ; j++) {
00808 if(charlist[j] == _text[start]) {
00809 found = true;
00810 break;
00811 }
00812 }
00813 if(false == found) {
00814 break;
00815 }
00816 }
00817
00818 if(start == length()) return "";
00819
00820 RUInt end;
00821 for(end = (length() - 1) ; ; end--) {
00822 RBool found = false;
00823 for(RUInt j = 0; j < charlist.length() ; j++) {
00824 if(charlist[j] == _text[end]) {
00825 found = true;
00826 break;
00827 }
00828 }
00829 if((false == found) || (0 == end)) {
00830 break;
00831 }
00832 }
00833
00834 return RString(getTextPointer(start),(end+1)-start);
00835 }
00836 };
00837
00838 inline std::ostream& operator<<(std::ostream& os, const RString& v) {
00839 if(v.length() > 0) os << v.c_str();
00840 return os;
00841 }
00842
00843 inline const RBool operator<(const RString & a, const RString & b) {
00844 if(b.length() > a.length()) {
00845 if(0 == a.length()) {
00846 return true;
00847 }
00848 for(RUInt i = 0; i < a.length(); i++) {
00849 if(a[i] < b[i]) return true;
00850 if(a[i] > b[i]) return false;
00851 }
00852 return true;
00853 } else {
00854 if(0 == b.length()) {
00855 return false;
00856 }
00857
00858 for(RUInt i = 0; i < b.length(); i++) {
00859 if(a[i] > b[i]) return false;
00860 if(a[i] < b[i]) return true;
00861 }
00862 if(a.length() == b.length()) {
00863 return false;
00864 }
00865 return false;
00866 }
00867 }
00868
00869 inline const RBool operator>(const RString & a, const RString & b) {
00870 if(b.length() > a.length()) {
00871 if(0 == a.length()) {
00872 return false;
00873 }
00874 for(RUInt i = 0; i < a.length(); i++) {
00875 if(a[i] > b[i]) return true;
00876 if(a[i] < b[i]) return false;
00877 }
00878 return true;
00879 } else {
00880 if(0 == b.length()) {
00881 return true;
00882 }
00883
00884 for(RUInt i = 0; i < b.length(); i++) {
00885 if(a[i] < b[i]) return false;
00886 if(a[i] > b[i]) return true;
00887 }
00888 if(a.length() == b.length()) {
00889 return false;
00890 }
00891 return true;
00892 }
00893 }
00894
00895 inline const RBool operator<=(const RString & a, const RString & b) {
00896 return !(a > b);
00897 }
00898
00899 inline const RBool operator>=(const RString & a, const RString & b) {
00900 return !(a < b);
00901 }
00902
00903 inline const RBool operator==(const RString & a, const RString & b) {
00904 if(a.length() != b.length()) return false;
00905 for(RUInt i = 0 ; i < a.length() ; i++) {
00906 if(a[i] != b[i]) return false;
00907 }
00908 return true;
00909 }
00910
00911 inline const RBool operator!=(const RString & a, const RString & b) {
00912 return !(a == b);
00913 }
00914
00915 inline RString operator+(const RString & a, const RString & b) {
00916 RString result(a);
00917 result += b;
00918 return result;
00919 }
00920
00921 inline RString operator+(const char & a, const RString & b) {
00922 return (RString(&a) + b);
00923 }
00924
00925 inline RString operator+(const RString & a, const char & b) {
00926 return (a + RString(&b));
00927 }
00928
00929 inline RString operator+(const int & a, const RString & b) {
00930 return (RString(a) + b);
00931 }
00932
00933 inline RString operator+(const RString & a, const int & b) {
00934 return (a + RString(b));
00935 }
00936
00937 inline RString operator+(const RString & a, const RUInt32 & b) {
00938 return (a + RString(b));
00939 }
00940
00941 inline RString operator+(const double & a, const RString & b) {
00942 return (RString(a) + b);
00943 }
00944
00945 inline RString operator+(const RString & a, const double & b) {
00946 return (a + RString(b));
00947 }
00948 };
00949 };
00950
00951 #endif
00952