00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef FXWSTRING_H
00025
#define FXWSTRING_H
00026
00027
namespace FX {
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 class FXAPI FXWString {
00038
private:
00039 FXwchar* str;
00040
public:
00041
static const FXwchar null[];
00042
static const FXwchar hex[17];
00043
static const FXwchar HEX[17];
00044
public:
00045
00046
00047 FXWString();
00048
00049
00050 FXWString(
const FXWString& s);
00051
00052
00053 FXWString(
const FXwchar* s);
00054
00055
00056 FXWString(
const FXwchar* s,FXint n);
00057
00058
00059 FXWString(FXwchar c,FXint n);
00060
00061
00062 FXWString(
const FXwchar *s1,
const FXwchar* s2);
00063
00064
00065
void length(FXint len);
00066
00067
00068 FXint length()
const {
return ((FXint*)str)[-1]; }
00069
00070
00071
const FXwchar* text()
const {
return (
const FXwchar*)str; }
00072
00073
00074 FXbool empty()
const {
return (((FXint*)str)[-1]==0); }
00075
00076
00077 FXwchar& operator[](FXint i){
return str[i]; }
00078
00079
00080
const FXwchar& operator[](FXint i)
const {
return str[i]; }
00081
00082
00083 FXWString& operator=(
const FXWString& s);
00084
00085
00086 FXWString& operator=(
const FXwchar* s);
00087
00088
00089 FXWString& fill(FXwchar c,FXint n);
00090
00091
00092 FXWString& fill(FXwchar c);
00093
00094
00095 FXWString& lower();
00096
00097
00098 FXWString& upper();
00099
00100
00101 FXWString section(FXwchar delim,FXint start,FXint num=1)
const;
00102
00103
00104 FXWString section(
const FXwchar* delim,FXint n,FXint start,FXint num=1)
const;
00105
00106
00107 FXWString section(
const FXwchar* delim,FXint start,FXint num=1)
const;
00108
00109
00110 FXWString section(
const FXWString& delim,FXint start,FXint num=1)
const;
00111
00112
00113 FXWString& assign(FXwchar c);
00114
00115
00116 FXWString& assign(FXwchar c,FXint n);
00117
00118
00119 FXWString& assign(
const FXwchar *s,FXint n);
00120
00121
00122 FXWString& assign(
const FXWString& s);
00123
00124
00125 FXWString& assign(
const FXwchar *s);
00126
00127
00128 FXWString& insert(FXint pos,FXwchar c);
00129
00130
00131 FXWString& insert(FXint pos,FXwchar c,FXint n);
00132
00133
00134 FXWString& insert(FXint pos,
const FXwchar* s,FXint n);
00135
00136
00137 FXWString& insert(FXint pos,
const FXWString& s);
00138
00139
00140 FXWString& insert(FXint pos,
const FXwchar* s);
00141
00142
00143 FXWString& prepend(FXwchar c);
00144
00145
00146 FXWString& prepend(FXwchar c,FXint n);
00147
00148
00149 FXWString& prepend(
const FXwchar *s,FXint n);
00150
00151
00152 FXWString& prepend(
const FXWString& s);
00153
00154
00155 FXWString& prepend(
const FXwchar *s);
00156
00157
00158 FXWString& append(FXwchar c);
00159
00160
00161 FXWString& append(FXwchar c,FXint n);
00162
00163
00164 FXWString& append(
const FXwchar *s,FXint n);
00165
00166
00167 FXWString& append(
const FXWString& s);
00168
00169
00170 FXWString& append(
const FXwchar *s);
00171
00172
00173 FXWString& replace(FXint pos,FXwchar c);
00174
00175
00176 FXWString& replace(FXint pos,FXint m,FXwchar c,FXint n);
00177
00178
00179 FXWString& replace(FXint pos,FXint m,
const FXwchar *s,FXint n);
00180
00181
00182 FXWString& replace(FXint pos,FXint m,
const FXWString& s);
00183
00184
00185 FXWString& replace(FXint pos,FXint m,
const FXwchar *s);
00186
00187
00188 FXWString& remove(FXint pos,FXint n=1);
00189
00190
00191 FXint contains(FXwchar ch);
00192
00193
00194 FXint contains(
const FXwchar* sub,FXint n);
00195
00196
00197 FXint contains(
const FXwchar* sub);
00198
00199
00200 FXint contains(
const FXWString& sub);
00201
00202
00203 FXWString& substitute(FXwchar org,FXwchar sub,FXbool all=TRUE);
00204
00205
00206 FXWString& substitute(
const FXwchar* org,FXint olen,
const FXwchar *rep,FXint rlen,FXbool all=TRUE);
00207
00208
00209 FXWString& substitute(
const FXwchar* org,
const FXwchar *rep,FXbool all=TRUE);
00210
00211
00212 FXWString& substitute(
const FXWString& org,
const FXWString& rep,FXbool all=TRUE);
00213
00214
00215 FXWString& simplify();
00216
00217
00218 FXWString& trim();
00219
00220
00221 FXWString& trimBegin();
00222
00223
00224 FXWString& trimEnd();
00225
00226
00227 FXWString& trunc(FXint pos);
00228
00229
00230 FXWString& clear();
00231
00232
00233 FXWString left(FXint n)
const;
00234
00235
00236 FXWString right(FXint n)
const;
00237
00238
00239 FXWString mid(FXint pos,FXint n)
const;
00240
00241
00242
00243
00244
00245
00246
00247 FXWString before(FXwchar ch,FXint n=1)
const;
00248
00249
00250
00251
00252
00253
00254
00255 FXWString rbefore(FXwchar ch,FXint n=1)
const;
00256
00257
00258
00259
00260
00261
00262
00263 FXWString after(FXwchar ch,FXint n=1)
const;
00264
00265
00266
00267
00268
00269
00270
00271 FXWString rafter(FXwchar ch,FXint n=1)
const;
00272
00273
00274 FXint find(FXwchar c,FXint pos=0)
const;
00275
00276
00277 FXint rfind(FXwchar c,FXint pos=2147483647)
const;
00278
00279
00280 FXint find(FXwchar c,FXint pos,FXint n)
const;
00281
00282
00283 FXint rfind(FXwchar c,FXint pos,FXint n)
const;
00284
00285
00286 FXint find(
const FXwchar* substr,FXint n,FXint pos)
const;
00287
00288
00289 FXint rfind(
const FXwchar* substr,FXint n,FXint pos)
const;
00290
00291
00292 FXint find(
const FXwchar* substr,FXint pos=0)
const;
00293
00294
00295 FXint rfind(
const FXwchar* substr,FXint pos=2147483647)
const;
00296
00297
00298 FXint find(
const FXWString &substr,FXint pos=0)
const;
00299
00300
00301 FXint rfind(
const FXWString &substr,FXint pos=2147483647)
const;
00302
00303
00304 FXint find_first_of(
const FXwchar *set,FXint n,FXint pos)
const;
00305
00306
00307 FXint find_first_of(
const FXwchar *set,FXint pos=0)
const;
00308
00309
00310 FXint find_first_of(
const FXWString &set,FXint pos=0)
const;
00311
00312
00313 FXint find_first_of(FXwchar c,FXint pos=0)
const;
00314
00315
00316 FXint find_last_of(
const FXwchar *set,FXint n,FXint pos)
const;
00317
00318
00319 FXint find_last_of(
const FXwchar *set,FXint pos=2147483647)
const;
00320
00321
00322 FXint find_last_of(
const FXWString &set,FXint pos=2147483647)
const;
00323
00324
00325 FXint find_last_of(FXwchar c,FXint pos=0)
const;
00326
00327
00328 FXint find_first_not_of(
const FXwchar *set,FXint n,FXint pos)
const;
00329
00330
00331 FXint find_first_not_of(
const FXwchar *set,FXint pos=0)
const;
00332
00333
00334 FXint find_first_not_of(
const FXWString &set,FXint pos=0)
const;
00335
00336
00337 FXint find_first_not_of(FXwchar c,FXint pos=0)
const;
00338
00339
00340 FXint find_last_not_of(
const FXwchar *set,FXint n,FXint pos)
const;
00341
00342
00343 FXint find_last_not_of(
const FXwchar *set,FXint pos=2147483647)
const;
00344
00345
00346 FXint find_last_not_of(
const FXWString &set,FXint pos=2147483647)
const;
00347
00348
00349 FXint find_last_not_of(FXwchar c,FXint pos=0)
const;
00350
00351
00352 FXint count(FXwchar c)
const;
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363 FXuint hash() const;
00364
00365
00366 friend FXAPI FXint compare(const FXwchar *s1,const FXwchar *s2);
00367 friend FXAPI FXint compare(const FXwchar *s1,const FXWString &s2);
00368 friend FXAPI FXint compare(const FXWString &s1,const FXwchar *s2);
00369 friend FXAPI FXint compare(const FXWString &s1,const FXWString &s2);
00370
00371
00372 friend FXAPI FXint compare(const FXwchar *s1,const FXwchar *s2,FXint n);
00373 friend FXAPI FXint compare(const FXwchar *s1,const FXWString &s2,FXint n);
00374 friend FXAPI FXint compare(const FXWString &s1,const FXwchar *s2,FXint n);
00375 friend FXAPI FXint compare(const FXWString &s1,const FXWString &s2,FXint n);
00376
00377
00378 friend FXAPI FXint comparecase(const FXwchar *s1,const FXwchar *s2);
00379 friend FXAPI FXint comparecase(const FXwchar *s1,const FXWString &s2);
00380 friend FXAPI FXint comparecase(const FXWString &s1,const FXwchar *s2);
00381 friend FXAPI FXint comparecase(const FXWString &s1,const FXWString &s2);
00382
00383
00384 friend FXAPI FXint comparecase(const FXwchar *s1,const FXwchar *s2,FXint n);
00385 friend FXAPI FXint comparecase(const FXwchar *s1,const FXWString &s2,FXint n);
00386 friend FXAPI FXint comparecase(const FXWString &s1,const FXwchar *s2,FXint n);
00387 friend FXAPI FXint comparecase(const FXWString &s1,const FXWString &s2,FXint n);
00388
00389
00390 friend FXAPI FXbool operator==(const FXWString &s1,const FXWString &s2);
00391 friend FXAPI FXbool operator==(const FXWString &s1,const FXwchar *s2);
00392 friend FXAPI FXbool operator==(const FXwchar *s1,const FXWString &s2);
00393
00394 friend FXAPI FXbool operator!=(const FXWString &s1,const FXWString &s2);
00395 friend FXAPI FXbool operator!=(const FXWString &s1,const FXwchar *s2);
00396 friend FXAPI FXbool operator!=(const FXwchar *s1,const FXWString &s2);
00397
00398 friend FXAPI FXbool operator<(const FXWString &s1,const FXWString &s2);
00399 friend FXAPI FXbool operator<(const FXWString &s1,const FXwchar *s2);
00400 friend FXAPI FXbool operator<(const FXwchar *s1,const FXWString &s2);
00401
00402 friend FXAPI FXbool operator<=(const FXWString &s1,const FXWString &s2);
00403 friend FXAPI FXbool operator<=(const FXWString &s1,const FXwchar *s2);
00404 friend FXAPI FXbool operator<=(const FXwchar *s1,const FXWString &s2);
00405
00406 friend FXAPI FXbool operator>(const FXWString &s1,const FXWString &s2);
00407 friend FXAPI FXbool operator>(const FXWString &s1,const FXwchar *s2);
00408 friend FXAPI FXbool operator>(const FXwchar *s1,const FXWString &s2);
00409
00410 friend FXAPI FXbool operator>=(const FXWString &s1,const FXWString &s2);
00411 friend FXAPI FXbool operator>=(const FXWString &s1,const FXwchar *s2);
00412 friend FXAPI FXbool operator>=(const FXwchar *s1,const FXWString &s2);
00413
00414
00415 FXWString& operator+=(const FXWString& s);
00416 FXWString& operator+=(const FXwchar* s);
00417 FXWString& operator+=(FXwchar c);
00418
00419
00420 friend FXAPI FXWString operator+(const FXWString& s1,const FXWString& s2);
00421 friend FXAPI FXWString operator+(const FXWString& s1,const FXwchar* s2);
00422 friend FXAPI FXWString operator+(const FXwchar* s1,const FXWString& s2);
00423
00424
00425 friend FXAPI FXWString operator+(const FXWString& s,FXwchar c);
00426 friend FXAPI FXWString operator+(FXwchar c,const FXWString& s);
00427
00428
00429 friend FXAPI
FXStream& operator<<(
FXStream& store,const FXWString& s);
00430
00431
00432 friend FXAPI
FXStream& operator>>(
FXStream& store,FXWString& s);
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462 friend FXAPI
void swap(FXWString& a,FXWString& b){ FXwchar *t=a.str; a.str=b.str; b.str=t; }
00463
00464
00465 ~FXWString();
00466 };
00467
00468 }
00469
00470
#endif