00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329 #ifdef P_USE_PRAGMA
00330 #pragma interface
00331 #endif
00332
00333 #include <string>
00334 #include <vector>
00335
00337
00338
00339 class PStringArray;
00340 class PRegularExpression;
00341
00376 class PString : public PCharArray {
00377 PCLASSINFO(PString, PCharArray);
00378
00379
00380
00381 public:
00387 PINLINE PString();
00388
00392 PINLINE PString(
00393 const PString & str
00394 );
00395
00398 PINLINE PString(
00399 const std::string & str
00400 );
00401
00410 PString(
00411 const char * cstr
00412 );
00413
00418 PString(
00419 const WORD * ustr
00420 );
00421
00435 PString(
00436 const char * cstr,
00437 PINDEX len
00438 );
00439
00450 PString(
00451 const WORD * ustr,
00452 PINDEX len
00453 );
00454
00465 PString(
00466 const PWORDArray & ustr
00467 );
00468
00477 PString(
00478 char ch
00479 );
00480
00485 PString(
00486 short n
00487 );
00488
00493 PString(
00494 unsigned short n
00495 );
00496
00501 PString(
00502 int n
00503 );
00504
00509 PString(
00510 unsigned int n
00511 );
00512
00517 PString(
00518 long n
00519 );
00520
00525 PString(
00526 unsigned long n
00527 );
00528
00533 PString(
00534 PInt64 n
00535 );
00536
00541 PString(
00542 PUInt64 n
00543 );
00544
00545
00546 enum ConversionType {
00547 Pascal,
00548 Basic,
00549 Literal,
00550 Signed,
00551 Unsigned,
00552 Decimal,
00553 Exponent,
00554 Printf,
00555 NumConversionTypes
00556 };
00557
00558
00559
00560
00561
00562
00563 PString(
00564 ConversionType type,
00565 const char * str,
00566 ...
00567 );
00568 PString(
00569 ConversionType type,
00570 long value,
00571 unsigned base = 10
00572 );
00573 PString(
00574 ConversionType type,
00575 double value,
00576 unsigned places
00577 );
00578
00586 PString & operator=(
00587 const PString & str
00588 );
00589
00599 PString & operator=(
00600 const char * cstr
00601 );
00602
00611 PString & operator=(
00612 char ch
00613 );
00614
00619 PString & operator=(
00620 short n
00621 );
00622
00627 PString & operator=(
00628 unsigned short n
00629 );
00630
00635 PString & operator=(
00636 int n
00637 );
00638
00643 PString & operator=(
00644 unsigned int n
00645 );
00646
00651 PString & operator=(
00652 long n
00653 );
00654
00659 PString & operator=(
00660 unsigned long n
00661 );
00662
00667 PString & operator=(
00668 PInt64 n
00669 );
00670
00675 PString & operator=(
00676 PUInt64 n
00677 );
00678
00681 virtual PString & MakeEmpty();
00682
00685 static PString Empty();
00687
00694 virtual PObject * Clone() const;
00695
00705 virtual Comparison Compare(
00706 const PObject & obj
00707 ) const;
00708
00711 virtual void PrintOn(
00712 ostream & strm
00713 ) const;
00714
00720 virtual void ReadFrom(
00721 istream & strm
00722 );
00723
00737 virtual PINDEX HashFunction() const;
00739
00754 virtual BOOL SetSize(
00755 PINDEX newSize
00756 );
00757
00766 virtual BOOL IsEmpty() const;
00767
00776 virtual BOOL MakeUnique();
00778
00779
00792 BOOL MakeMinimumSize();
00793
00802 PINLINE PINDEX GetLength() const;
00803
00810 bool operator!() const;
00812
00821 PString operator+(
00822 const PString & str
00823 ) const;
00824
00836 PString operator+(
00837 const char * cstr
00838 ) const;
00839
00851 PString operator+(
00852 char ch
00853 ) const;
00854
00866 friend PString operator+(
00867 const char * cstr,
00868 const PString & str
00869 );
00870
00882 friend PString operator+(
00883 char c,
00884 const PString & str
00885 );
00886
00892 PString & operator+=(
00893 const PString & str
00894 );
00895
00905 PString & operator+=(
00906 const char * cstr
00907 );
00908
00918 PString & operator+=(
00919 char ch
00920 );
00921
00922
00929 PString operator&(
00930 const PString & str
00931 ) const;
00932
00949 PString operator&(
00950 const char * cstr
00951 ) const;
00952
00969 PString operator&(
00970 char ch
00971 ) const;
00972
00989 friend PString operator&(
00990 const char * cstr,
00991 const PString & str
00992 );
00993
01010 friend PString operator&(
01011 char ch,
01012 const PString & str
01013 );
01014
01020 PString & operator&=(
01021 const PString & str
01022 );
01023
01038 PString & operator&=(
01039 const char * cstr
01040 );
01041
01042
01057 PString & operator&=(
01058 char ch
01059 );
01061
01062
01070 bool operator*=(
01071 const PString & str
01072 ) const;
01073
01081 bool operator==(
01082 const PObject & str
01083 ) const;
01084
01092 bool operator!=(
01093 const PObject & str
01094 ) const;
01095
01103 bool operator<(
01104 const PObject & str
01105 ) const;
01106
01114 bool operator>(
01115 const PObject & str
01116 ) const;
01117
01125 bool operator<=(
01126 const PObject & str
01127 ) const;
01128
01136 bool operator>=(
01137 const PObject & str
01138 ) const;
01139
01140
01151 bool operator*=(
01152 const char * cstr
01153 ) const;
01154
01165 bool operator==(
01166 const char * cstr
01167 ) const;
01168
01179 bool operator!=(
01180 const char * cstr
01181 ) const;
01182
01193 bool operator<(
01194 const char * cstr
01195 ) const;
01196
01207 bool operator>(
01208 const char * cstr
01209 ) const;
01210
01221 bool operator<=(
01222 const char * cstr
01223 ) const;
01224
01235 bool operator>=(
01236 const char * cstr
01237 ) const;
01238
01250 Comparison NumCompare(
01251 const PString & str,
01252 PINDEX count = P_MAX_INDEX,
01253 PINDEX offset = 0
01254 ) const;
01255
01267 Comparison NumCompare(
01268 const char * cstr,
01269 PINDEX count = P_MAX_INDEX,
01270 PINDEX offset = 0
01271 ) const;
01273
01274
01278 PINDEX Find(
01279 char ch,
01280 PINDEX offset = 0
01281 ) const;
01282
01284 PINDEX Find(
01285 const PString & str,
01286 PINDEX offset = 0
01287 ) const;
01288
01289
01290
01291
01292
01293
01294
01295
01296
01297
01298
01299
01300
01301
01302
01303 PINDEX Find(
01304 const char * cstr,
01305 PINDEX offset = 0
01306 ) const;
01307
01309 PINDEX FindLast(
01310 char ch,
01311 PINDEX offset = P_MAX_INDEX
01312 ) const;
01313
01315 PINDEX FindLast(
01316 const PString & str,
01317 PINDEX offset = P_MAX_INDEX
01318 ) const;
01319
01337 PINDEX FindLast(
01338 const char * cstr,
01339 PINDEX offset = P_MAX_INDEX
01340 ) const;
01341
01343 PINDEX FindOneOf(
01344 const PString & set,
01345 PINDEX offset = 0
01346 ) const;
01347
01362 PINDEX FindOneOf(
01363 const char * cset,
01364 PINDEX offset = 0
01365 ) const;
01366
01377 PINDEX FindRegEx(
01378 const PRegularExpression & regex,
01379 PINDEX offset = 0
01380 ) const;
01381
01392 BOOL FindRegEx(
01393 const PRegularExpression & regex,
01394 PINDEX & pos,
01395 PINDEX & len,
01396 PINDEX offset = 0,
01397 PINDEX maxPos = P_MAX_INDEX
01398 ) const;
01399
01400
01411 void Replace(
01412 const PString & target,
01413 const PString & subs,
01414 BOOL all = FALSE,
01415 PINDEX offset = 0
01416 );
01417
01425 void Splice(
01426 const PString & str,
01427 PINDEX pos,
01428 PINDEX len = 0
01429 );
01430
01438 void Splice(
01439 const char * cstr,
01440 PINDEX pos,
01441 PINDEX len = 0
01442 );
01443
01450 void Delete(
01451 PINDEX start,
01452 PINDEX len
01453 );
01455
01456
01476 PString operator()(
01477 PINDEX start,
01478 PINDEX end
01479 ) const;
01480
01495 PString Left(
01496 PINDEX len
01497 ) const;
01498
01513 PString Right(
01514 PINDEX len
01515 ) const;
01516
01533 PString Mid(
01534 PINDEX start,
01535 PINDEX len = P_MAX_INDEX
01536 ) const;
01537
01538
01546 PString LeftTrim() const;
01547
01555 PString RightTrim() const;
01556
01565 PString Trim() const;
01566
01567
01576 PString ToLower() const;
01577
01586 PString ToUpper() const;
01587
01588
01590 PStringArray Tokenise(
01591 const PString & separators,
01593 BOOL onePerSeparator = TRUE
01595 ) const;
01618 PStringArray Tokenise(
01619 const char * cseparators,
01621 BOOL onePerSeparator = TRUE
01623 ) const;
01624
01638 PStringArray Lines() const;
01640
01657 PString & sprintf(
01658 const char * cfmt,
01659 ...
01660 );
01661
01676 friend PString psprintf(
01677 const char * cfmt,
01678 ...
01679 );
01680
01682 PString & vsprintf(
01683 const PString & fmt,
01684 va_list args
01685 );
01700 PString & vsprintf(
01701 const char * cfmt,
01702 va_list args
01703 );
01704
01706 friend PString pvsprintf(
01707 const char * cfmt,
01708 va_list args
01709 );
01724 friend PString pvsprintf(
01725 const PString & fmt,
01726 va_list args
01727 );
01728
01729
01742 long AsInteger(
01743 unsigned base = 10
01744 ) const;
01757 DWORD AsUnsigned(
01758 unsigned base = 10
01759 ) const;
01773 PInt64 AsInt64(
01774 unsigned base = 10
01775 ) const;
01789 PUInt64 AsUnsigned64(
01790 unsigned base = 10
01791 ) const;
01792
01803 double AsReal() const;
01804
01808 PWORDArray AsUCS2() const;
01809
01820 PBYTEArray ToPascal() const;
01821
01830 PString ToLiteral() const;
01831
01839 operator const unsigned char *() const;
01840
01842
01843
01844 protected:
01845 void InternalFromUCS2(
01846 const WORD * ptr,
01847 PINDEX len
01848 );
01849 virtual Comparison InternalCompare(
01850 PINDEX offset,
01851 char c
01852 ) const;
01853 virtual Comparison InternalCompare(
01854 PINDEX offset,
01855 PINDEX length,
01856 const char * cstr
01857 ) const;
01858
01859
01860
01861
01862
01863
01864
01865 PString(int dummy, const PString * str);
01866 };
01867
01868
01870
01880 class PCaselessString : public PString
01881 {
01882 PCLASSINFO(PCaselessString, PString);
01883
01884 public:
01887 PCaselessString();
01888
01892 PCaselessString(
01893 const char * cstr
01894 );
01895
01900 PCaselessString(
01901 const PString & str
01902 );
01903
01904
01912 PCaselessString & operator=(
01913 const PString & str
01914 );
01915
01925 PCaselessString & operator=(
01926 const char * cstr
01927 );
01928
01937 PCaselessString & operator=(
01938 char ch
01939 );
01940
01941
01942
01947 virtual PObject * Clone() const;
01948
01949 protected:
01950
01951 virtual Comparison InternalCompare(
01952 PINDEX offset,
01953 char c
01954 ) const;
01955 virtual Comparison InternalCompare(
01956 PINDEX offset,
01957 PINDEX length,
01958 const char * cstr
01959 ) const;
01960
01961
01962
01963
01964
01965
01966
01967 PCaselessString(int dummy, const PCaselessString * str);
01968 };
01969
01971
01972 class PStringStream;
01973
01980 class PStringStream : public PString, public iostream
01981 {
01982 PCLASSINFO(PStringStream, PString);
01983
01984 public:
01990 PStringStream();
01991
01996 PStringStream(
01997 PINDEX fixedBufferSize
01998 );
01999
02006 PStringStream(
02007 const PString & str
02008 );
02009
02014 PStringStream(
02015 const char * cstr
02016 );
02017
02020 virtual PString & MakeEmpty();
02021
02033 PStringStream & operator=(
02034 const PStringStream & strm
02035 );
02036
02048 PStringStream & operator=(
02049 const PString & str
02050 );
02051
02067 PStringStream & operator=(
02068 const char * cstr
02069 );
02070
02079 PStringStream & operator=(
02080 char ch
02081 );
02082
02083
02085 virtual ~PStringStream();
02086
02087
02088 protected:
02089 virtual void AssignContents(const PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160
02164 PStringArray(
02165 const std::vector<PString> & vec
02166 )
02167 {
02168 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02169 AppendString(*r);
02170 }
02171
02175 PStringArray(
02176 const std::vector<std::string> & vec
02177 )
02178 {
02179 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02180 AppendString(PString(*r));
02181 }
02182
02186 template <typename stlContainer>
02187 static PStringArray container(
02188 const stlContainer & vec
02189 )
02190 {
02191 PStringArray list;
02192 for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02193 list.AppendString(PString(*r));
02194 return list;
02195 }
02196
02198
02206 virtual void ReadFrom(
02207 istream &strm
02208 );
02210
02219 PINDEX GetStringsIndex(
02220 const PString & str
02221 ) const;
02222
02223 PString operator[](
02224 PINDEX il">Pnst PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160
02164 PStringArray(
02165 const std::vector<PString> & vec
02166 )
02167 {
02168 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02169 AppendString(*r);
02170 }
02171
02175 PStringArray(
02176 const std::vector<std::string> & vec
02177 )
02178 {
02179 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02180 AppendString(PString(*r));
02181 }
02182
02186 template <typename stlContainer>
02187 static PStringArray container(
02188 const stlContainer & vec
02189 )
02190 {
02191 PStringArray list;
02192 for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02193 list.AppendString(PString(*r));
02194 return list;
02195 }
02196
02198
02206 virtual void ReadFrom(
02207 istream &strm
02208 );
02210
02219 PINDEX GetStringsIndex(
02220 const PString & str
02221 ) const;
02222
02223 PString operator[](
02224 PINDEX il">Pnst PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160
02164 PStringArray(
02165 const std::vector<PString> & vec
02166 )
02167 {
02168 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02169 AppendString(*r);
02170 }
02171
02175 PStringArray(
02176 const std::vector<std::string> & vec
02177 )
02178 {
02179 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02180 AppendString(PString(*r));
02181 }
02182
02186 template <typename stlContainer>
02187 static PStringArray container(
02188 const stlContainer & vec
02189 )
02190 {
02191 PStringArray list;
02192 for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02193 list.AppendString(PString(*r));
02194 return list;
02195 }
02196
02198
02206 virtual void ReadFrom(
02207 istream &strm
02208 );
02210
02219 PINDEX GetStringsIndex(
02220 const PString & str
02221 ) const;
02222
02223 PString operator[](
02224 PINDEX il">Pnst PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160
02164 PStringArray(
02165 const std::vector<PString> & vec
02166 )
02167 {
02168 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02169 AppendString(*r);
02170 }
02171
02175 PStringArray(
02176 const std::vector<std::string> & vec
02177 )
02178 {
02179 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02180 AppendString(PString(*r));
02181 }
02182
02186 template <typename stlContainer>
02187 static PStringArray container(
02188 const stlContainer & vec
02189 )
02190 {
02191 PStringArray list;
02192 for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02193 list.AppendString(PString(*r));
02194 return list;
02195 }
02196
02198
02206 virtual void ReadFrom(
02207 istream &strm
02208 );
02210
02219 PINDEX GetStringsIndex(
02220 const PString & str
02221 ) const;
02222
02223 PString operator[](
02224 PINDEX il">Pnst PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160
02164 PStringArray(
02165 const std::vector<PString> & vec
02166 )
02167 {
02168 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02169 AppendString(*r);
02170 }
02171
02175 PStringArray(
02176 const std::vector<std::string> & vec
02177 )
02178 {
02179 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02180 AppendString(PString(*r));
02181 }
02182
02186 template <typename stlContainer>
02187 static PStringArray container(
02188 const stlContainer & vec
02189 )
02190 {
02191 PStringArray list;
02192 for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02193 list.AppendString(PString(*r));
02194 return list;
02195 }
02196
02198
02206 virtual void ReadFrom(
02207 istream &strm
02208 );
02210
02219 PINDEX GetStringsIndex(
02220 const PString & str
02221 ) const;
02222
02223 PString operator[](
02224 PINDEX il">Pnst PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160
02164 PStringArray(
02165 const std::vector<PString> & vec
02166 )
02167 {
02168 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02169 AppendString(*r);
02170 }
02171
02175 PStringArray(
02176 const std::vector<std::string> & vec
02177 )
02178 {
02179 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02180 AppendString(PString(*r));
02181 }
02182
02186 template <typename stlContainer>
02187 static PStringArray container(
02188 const stlContainer & vec
02189 )
02190 {
02191 PStringArray list;
02192 for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02193 list.AppendString(PString(*r));
02194 return list;
02195 }
02196
02198
02206 virtual void ReadFrom(
02207 istream &strm
02208 );
02210
02219 PINDEX GetStringsIndex(
02220 const PString & str
02221 ) const;
02222
02223 PString operator[](
02224 PINDEX il">Pnst PContainer & cont);
02090
02091 private:
02092 PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02093
02094 class Buffer : public streambuf {
02095 public:
02096 Buffer(PStringStream & str, PINDEX size);
02097 Buffer(const Buffer & sbuf);
02098 Buffer & operator=(const Buffer & sbuf);
02099 virtual int overflow(int=EOF);
02100 virtual int underflow();
02101 virtual int sync();
02102 #ifdef __USE_STL__
02103 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02104 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02105 #else
02106 virtual streampos seekoff(streamoff, ios::seek_dir, int);
02107 #endif
02108 PStringStream & string;
02109 BOOL fixedBufferSize;
02110 };
02111 };
02112
02113
02114 class PStringList;
02115 class PSortedStringList;
02116
02129 #ifdef DOC_PLUS_PLUS
02130 class PStringArray : public PArray {
02131 #endif
02132 PDECLARE_ARRAY(PStringArray, PString);
02133 public:
02140 PStringArray(
02141 PINDEX count,
02142 char const * const * strarr,
02143 BOOL caseless = FALSE
02144 );
02147 PStringArray(
02148 const PString & str
02149 );
02152 PStringArray(
02153 const PStringList & list
02154 );
02157 PStringArray(
02158 const PSortedStringList & list
02159 );
02160