pstring.h

Go to the documentation of this file.
00001 /*
00002  * pstring.h
00003  *
00004  * Character string class.
00005  *
00006  * Portable Windows Library
00007  *
00008  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
00009  *
00010  * The contents of this file are subject to the Mozilla Public License
00011  * Version 1.0 (the "License"); you may not use this file except in
00012  * compliance with the License. You may obtain a copy of the License at
00013  * http://www.mozilla.org/MPL/
00014  *
00015  * Software distributed under the License is distributed on an "AS IS"
00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
00017  * the License for the specific language governing rights and limitations
00018  * under the License.
00019  *
00020  * The Original Code is Portable Windows Library.
00021  *
00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
00023  *
00024  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
00025  * All Rights Reserved.
00026  *
00027  * Contributor(s): ______________________________________.
00028  *
00029  * $Log: pstring.h,v $
00030  * Revision 1.94  2007/10/08 05:04:10  rjongbloed
00031  * Fixed bug introduced to prevent execution if had compiler error, did not allow
00032  *   for getting NoMatch error on execution and using an instance twice.
00033  * Also made lastError member mutable to clean up lots of cont casts.
00034  *
00035  * Revision 1.93  2007/06/29 02:47:28  rjongbloed
00036  * Added PString::FindSpan() function (strspn equivalent) with slightly nicer semantics.
00037  *
00038  * Revision 1.92  2007/04/08 01:53:16  ykiryanov
00039  * Build to support ptlib dll creation
00040  *
00041  * Revision 1.91  2006/08/11 08:18:57  csoutheren
00042  * Add PCaselessString constructor for std::string
00043  *
00044  * Revision 1.90  2006/08/11 04:44:48  csoutheren
00045  * Add operator to convert PString to std::string
00046  *
00047  * Revision 1.89  2006/07/10 09:15:28  shorne
00048  * Corrected PString::Tokenize() documentation Thx. David Corrie
00049  *
00050  * Revision 1.88  2006/06/30 00:56:31  csoutheren
00051  * Applied 1494931 - various pwlib bug fixes and enhancement
00052  * Thanks to Frederich Heem
00053  *
00054  * Revision 1.87  2006/06/21 03:28:41  csoutheren
00055  * Various cleanups thanks for Frederic Heem
00056  *
00057  * Revision 1.86  2006/04/09 07:05:40  rjongbloed
00058  * Moved output stream operator for PString from sockets code to string code and fixed
00059  *   its implemetation to continue to use PrintOn. Why it was added is unknown, probably
00060  *   a compiler issue, but it should not be in a random source file!
00061  *
00062  * Revision 1.85  2005/12/15 21:14:34  dsandras
00063  * Fixed from Alexander Larsson <alexl _AT__ redhat.com> for gcc 4.1 compilation. Thanks!
00064  *
00065  * Revision 1.84  2005/11/30 12:47:38  csoutheren
00066  * Removed tabs, reformatted some code, and changed tags for Doxygen
00067  *
00068  * Revision 1.83  2005/11/25 03:43:47  csoutheren
00069  * Fixed function argument comments to be compatible with Doxygen
00070  *
00071  * Revision 1.82  2005/09/18 11:05:36  dominance
00072  * include/ptlib/channel.h, include/ptlib/pstring.h, src/ptlib/common/contain.cxx,
00073  * src/ptlib/common/pchannel.cxx:
00074  *   correct the STL defined checking to use proper syntax.
00075  *
00076  * include/ptlib/object.h:
00077  *   re-add typedef to compile on mingw
00078  *
00079  * make/ptlib-config.in:
00080  *   import a long-standing fix from the Debian packs which allows usage of
00081  *   ptlib-config without manually adding -lpt for each of the subsequent
00082  *   projects
00083  *
00084  * Revision 1.81  2004/12/22 04:04:36  dereksmithies
00085  * Modify description of parameters for PString::Replace()
00086  *
00087  * Revision 1.80  2004/11/23 11:33:08  csoutheren
00088  * Fixed problem with RemoveAt returning invalid pointer in some cases,
00089  * and added extra documentation on this case.
00090  * Thanks to Diego Tartara for pointing out this potential problem
00091  *
00092  * Revision 1.79  2004/10/21 13:04:20  rjongbloed
00093  * Fixed possibility of const operator[] on PStringArray returning a NULL reference. This
00094  *   function should return a non-lvalue PString anyway as it is const!
00095  *
00096  * Revision 1.78  2004/08/16 08:49:59  csoutheren
00097  * Removed error when compiling with gcc
00098  *
00099  * Revision 1.77  2004/08/16 06:40:59  csoutheren
00100  * Added adapters template to make device plugins available via the abstract factory interface
00101  *
00102  * Revision 1.76  2004/06/01 05:54:18  csoutheren
00103  * Added <vector> and <string>
00104  *
00105  * Revision 1.75  2004/06/01 05:21:38  csoutheren
00106  * Added conversions between std::string and PString, and vector<PString> and PStringArray
00107  *
00108  * Revision 1.74  2004/05/04 11:10:36  rjongbloed
00109  * Fixed usage of MakeEmpty() with PStringStream.
00110  *
00111  * Revision 1.73  2004/04/18 04:33:36  rjongbloed
00112  * Changed all operators that return BOOL to return standard type bool. This is primarily
00113  *   for improved compatibility with std STL usage removing many warnings.
00114  *
00115  * Revision 1.72  2004/04/11 13:26:25  csoutheren
00116  * Removed namespace problems and removed warnings for Windows <string>
00117  *
00118  * Revision 1.71  2004/04/09 06:38:10  rjongbloed
00119  * Fixed compatibility with STL based streams, eg as used by VC++2003
00120  *
00121  * Revision 1.70  2004/04/09 03:42:34  csoutheren
00122  * Removed all usages of "virtual inline" and "inline virtual"
00123  *
00124  * Revision 1.69  2004/04/03 06:54:22  rjongbloed
00125  * Many and various changes to support new Visual C++ 2003
00126  *
00127  * Revision 1.68  2004/02/23 00:44:38  csoutheren
00128  * A completely different, other regex include hack to avoid requiring
00129  * the sources when using a header-file only environment
00130  *
00131  * Revision 1.67  2004/02/23 00:26:05  csoutheren
00132  * Finally, a generic and elegant fix for the regex include hacks.  Thanks to Roger Hardiman
00133  *
00134  * Revision 1.66  2004/02/11 05:09:14  csoutheren
00135  * Fixed problems with regex libraries on Solaris, and with host OS numbering
00136  * being a quoted string rather than a number. Thanks to Chad Attermann
00137  * Fixed problems SSL detection problems thanks to Michal Zygmuntowicz
00138  *
00139  * Revision 1.65  2004/02/08 11:13:11  rjongbloed
00140  * Fixed crash in heavily loaded multi-threaded systems using simultaneous sorted
00141  *   lists, Thanks Federico Pinna, Fabrizio Ammollo and the gang at Reitek S.p.A.
00142  *
00143  * Revision 1.64  2004/01/18 13:43:48  rjongbloed
00144  * Fixed broken PString::MakeEmpty() function and moved implementations to .inl file.
00145  *
00146  * Revision 1.63  2004/01/17 18:15:24  csoutheren
00147  * Fixed multi-threading problem with PString::Empty
00148  * Created PString::MakeEmpty for efficient emptying of existing strings
00149  *
00150  * Revision 1.62  2004/01/16 13:24:37  csoutheren
00151  * Changed PString::Empty to be thread-safe
00152  * Fixed PContainer::SetMinSize and PAbstractArray::SetSize, thanks to 123@call2ua.com
00153  * Fixed PString::FindLast, thanks to Andreas Sikkema
00154  *
00155  * Revision 1.61  2003/12/13 23:08:46  csoutheren
00156  * Changed PRegularExpression to allow a copy constructor and operator =
00157  *
00158  * Revision 1.60  2003/12/10 03:28:50  csoutheren
00159  * Removed compile time warning under Linux
00160  *
00161  * Revision 1.59  2003/12/07 05:50:49  csoutheren
00162  * Blocked operator = for PRegularExpression
00163  *
00164  * Revision 1.58  2003/12/04 13:10:38  csoutheren
00165  * Made PRegularExpression copy constructor private to avoid accidental usage (and subsequent crash)
00166  *
00167  * Revision 1.57  2003/05/14 00:46:47  rjongbloed
00168  * Added constructor to string lists/arrays etc that takes a single PString.
00169  *
00170  * Revision 1.56  2003/03/31 01:23:56  robertj
00171  * Added ReadFrom functions for standard container classes such as
00172  *   PIntArray and PStringList etc
00173  *
00174  * Revision 1.55  2003/03/05 08:48:32  robertj
00175  * Added PStringArray::ToCharAray() function at suggestion of Ravelli Rossano
00176  *
00177  * Revision 1.54  2002/11/12 09:17:44  robertj
00178  * Added PString::NumCompare() as functional equivalent of strncmp().
00179  * Added PSortedStringList::GetNextStringsIndex() to do searches of binary
00180  *   tree on partal strings.
00181  *
00182  * Revision 1.53  2002/10/31 05:53:44  robertj
00183  * Now comprehensively stated that a PString is ALWAYS an 8 bit string as
00184  *   there are far too many inheerent assumptions every to make it 16 bit.
00185  * Added UTF-8/UCS-2 conversion functions to PString.
00186  *
00187  * Revision 1.52  2002/09/16 01:08:59  robertj
00188  * Added #define so can select if #pragma interface/implementation is used on
00189  *   platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.
00190  *
00191  * Revision 1.51  2002/08/14 00:43:39  robertj
00192  * Added ability to have fixed maximum length PStringStream's so does not do
00193  *   unwanted malloc()'s while outputing data.
00194  *
00195  * Revision 1.50  2002/04/09 02:30:18  robertj
00196  * Removed GCC3 variable as __GNUC__ can be used instead, thanks jason Spence
00197  *
00198  * Revision 1.49  2002/02/15 04:29:31  robertj
00199  * Added PString::Empty() to return the primordial empty string. Saves on a
00200  *   couple of memory allocations for every empty string ever used.
00201  *
00202  * Revision 1.48  2002/01/26 23:55:55  craigs
00203  * Changed for GCC 3.0 compatibility, thanks to manty@manty.net
00204  *
00205  * Revision 1.47  2002/01/22 01:03:57  craigs
00206  * Added operator += and operator + functions to PStringArray and PStringList
00207  * Added AppendString operator to PStringArray
00208  *
00209  * Revision 1.46  2001/10/17 05:09:22  robertj
00210  * Added contructors and assigmnent operators so integer types can be
00211  *   automatically converted to strings.
00212  *
00213  * Revision 1.45  2001/08/11 07:57:30  rogerh
00214  * Add Mac OS Carbon changes from John Woods <jfw@jfwhome.funhouse.com>
00215  *
00216  * Revision 1.44  2001/04/18 04:10:15  robertj
00217  * Removed hash function for caseless strings as confuses mixed dictionaries.
00218  *
00219  * Revision 1.43  2001/04/18 01:20:58  robertj
00220  * Fixed problem with hash function for short strings, thanks Patrick Koorevaar.
00221  * Also fixed hash function for caseless strings.
00222  *
00223  * Revision 1.42  2001/02/21 03:38:37  robertj
00224  * Added ability to copy between various string lists/arrays etc during construction.
00225  *
00226  * Revision 1.41  2001/02/13 04:39:08  robertj
00227  * Fixed problem with operator= in container classes. Some containers will
00228  *   break unless the copy is virtual (eg PStringStream's buffer pointers) so
00229  *   needed to add a new AssignContents() function to all containers.
00230  *
00231  * Revision 1.40  1999/08/22 12:13:43  robertj
00232  * Fixed warning when using inlines on older GNU compiler
00233  *
00234  * Revision 1.39  1999/05/28 14:01:22  robertj
00235  * Added initialisers to string containers (list, sorted list and set).
00236  *
00237  * Revision 1.38  1999/03/09 09:34:05  robertj
00238  * Fixed typo's.
00239  *
00240  * Revision 1.37  1999/03/09 02:59:50  robertj
00241  * Changed comments to doc++ compatible documentation.
00242  *
00243  * Revision 1.36  1999/02/16 08:11:09  robertj
00244  * MSVC 6.0 compatibility changes.
00245  *
00246  * Revision 1.35  1998/09/23 06:21:12  robertj
00247  * Added open source copyright license.
00248  *
00249  * Revision 1.34  1998/01/26 00:33:46  robertj
00250  * Added FindRegEx function to PString that returns position and length.
00251  * Added Execute() functions to PRegularExpression that take PINDEX references instead of PIntArrays.
00252  * Added static function to PRegularExpression to escape all special operator characters in a string.
00253  *
00254  * Revision 1.33  1998/01/05 10:39:35  robertj
00255  * Fixed "typesafe" templates/macros for dictionaries, especially on GNU.
00256  *
00257  * Revision 1.32  1997/12/11 13:32:47  robertj
00258  * Added AsUnsigned() function to convert string to DWORD.
00259  *
00260  * Revision 1.31  1997/12/11 10:29:49  robertj
00261  * Added type correct Contains() function to dictionaries.
00262  *
00263  * Revision 1.30  1997/07/08 13:13:47  robertj
00264  * DLL support.
00265  *
00266  * Revision 1.29  1997/06/10 11:36:32  craigs
00267  * Added inline statements to allow compilation uder Unix
00268  *
00269  * Revision 1.28  1997/06/08 04:48:58  robertj
00270  * Added regular expressions.
00271  * Fixed non-template class descendent order.
00272  *
00273  * Revision 1.27  1997/05/16 12:10:12  robertj
00274  * Fixed G++ compatibility bug.
00275  *
00276  * Revision 1.26  1996/10/08 13:13:38  robertj
00277  * Added operator += and &= for char so no implicit PString construction.
00278  *
00279  * Revision 1.25  1996/09/14 12:52:39  robertj
00280  * Added operator! for !IsEmpty().
00281  *
00282  * Revision 1.24  1996/08/17 10:00:25  robertj
00283  * Changes for Windows DLL support.
00284  *
00285  * Revision 1.23  1996/05/26 03:27:02  robertj
00286  * Compatibility to GNU 2.7.x
00287  *
00288  * Revision 1.22  1996/03/31 08:51:22  robertj
00289  * Added RemoveAt() function to remove entries from dictionaries.
00290  *
00291  * Revision 1.21  1996/03/10 13:15:50  robertj
00292  * Added operator() to template version.
00293  *
00294  * Revision 1.20  1996/02/19 13:17:33  robertj
00295  * Removed PCaselessString hash function to fix dictionary match failure.
00296  * Added operator() to do string dictionary lookup with default value.
00297  *
00298  * Revision 1.19  1996/02/08 12:19:16  robertj
00299  * Added new operators to PString for case insensitive compare and spaced concatenate.
00300  *
00301  * Revision 1.18  1996/01/24 14:43:15  robertj
00302  * Added initialisers to string dictionaries.
00303  *
00304  * Revision 1.17  1996/01/23 13:15:17  robertj
00305  * Added Replace() function to strings.
00306  * Mac Metrowerks compiler support.
00307  * String searching algorithm rewrite.
00308  *
00309  * Revision 1.16  1996/01/02 12:04:31  robertj
00310  * Mac OS compatibility changes.
00311  * Removed requirement that PArray elements have parameterless constructor..
00312  *
00313  * Revision 1.15  1995/12/23 03:46:23  robertj
00314  * Added operators for include and exclude from string set.
00315  *
00316  * Revision 1.14  1995/10/14 15:02:56  robertj
00317  * Changed arrays to not break references, but strings still need to.
00318  *
00319  * Revision 1.13  1995/06/17 11:13:08  robertj
00320  * Documentation update.
00321  *
00322  * Revision 1.12  1995/06/17 00:43:40  robertj
00323  * Added flag for PStringArray constructor to create caseless strings.
00324  *
00325  * Revision 1.11  1995/06/04 12:34:57  robertj
00326  * Better C++ compatibility (with BC++)
00327  *
00328  * Revision 1.10  1995/04/02 09:27:23  robertj
00329  * Added "balloon" help.
00330  *
00331  * Revision 1.9  1995/03/14 12:42:16  robertj
00332  * Updated documentation to use HTML codes.
00333  *
00334  * Revision 1.8  1995/03/12  04:44:39  robertj
00335  * Fixed use of PCaselessString as dictionary key.
00336  *
00337  * Revision 1.7  1995/02/05  00:48:09  robertj
00338  * Fixed template version.
00339  *
00340  * Revision 1.6  1995/01/15  04:50:20  robertj
00341  * Added inlines on friend functions, required by GNU compiler.
00342  *
00343  * Revision 1.5  1995/01/10  11:43:41  robertj
00344  * Removed PString parameter in stdarg function for GNU C++ compatibility.
00345  *
00346  * Revision 1.4  1995/01/09  12:33:44  robertj
00347  * Removed unnecesary return value from I/O functions.
00348  * Changed function names due to Mac port.
00349  *
00350  * Revision 1.3  1994/12/21  11:53:21  robertj
00351  * Documentation and variable normalisation.
00352  *
00353  * Revision 1.2  1994/12/12  13:13:13  robertj
00354  * Fixed bugs in PString mods just made.
00355  *
00356  * Revision 1.1  1994/12/12  09:59:37  robertj
00357  * Initial revision
00358  *
00359  */
00360 #ifndef __PSTRING__
00361 #define __PSTRING__
00362 
00363 #ifdef P_USE_PRAGMA
00364 #pragma interface
00365 #endif
00366 
00367 #include <string>
00368 #include <vector>
00369 #include <ptlib/array.h>
00370 
00372 // PString class
00373 
00374 class PStringArray;
00375 class PRegularExpression;
00376 
00411 class PString : public PCharArray {
00412   PCLASSINFO(PString, PCharArray);
00413 
00414 //  using namespace std;
00415 
00416   public:
00422     PINLINE PString();
00423 
00427     PINLINE PString(
00428       const PString & str  
00429     );
00430 
00433     PINLINE PString(
00434       const std::string & str
00435     );
00436 
00445     PString(
00446       const char * cstr 
00447     );
00448 
00453     PString(
00454       const WORD * ustr 
00455     );
00456 
00470     PString(
00471       const char * cstr,  
00472       PINDEX len          
00473     );
00474 
00485     PString(
00486       const WORD * ustr,  
00487       PINDEX len          
00488     );
00489 
00500     PString(
00501       const PWORDArray & ustr 
00502     );
00503 
00512     PString(
00513       char ch    
00514     );
00515 
00520     PString(
00521       short n   
00522     );
00523 
00528     PString(
00529       unsigned short n   
00530     );
00531 
00536     PString(
00537       int n   
00538     );
00539 
00544     PString(
00545       unsigned int n   
00546     );
00547 
00552     PString(
00553       long n   
00554     );
00555 
00560     PString(
00561       unsigned long n   
00562     );
00563 
00568     PString(
00569       PInt64 n   
00570     );
00571 
00576     PString(
00577       PUInt64 n   
00578     );
00579 
00580  
00581     enum ConversionType {
00582       Pascal,   // Data is a length byte followed by characters.
00583       Basic,    // Data is two length bytes followed by characters.
00584       Literal,  // Data is C language style string with \ escape codes.
00585       Signed,   // Convert a signed integer to a string.
00586       Unsigned, // Convert an unsigned integer to a string.
00587       Decimal,  // Convert a real number to a string in decimal format.
00588       Exponent, // Convert a real number to a string in exponent format.
00589       Printf,   // Formatted output, sprintf() style function.
00590       NumConversionTypes
00591     };
00592     /* Type of conversion to make in the conversion constructors.
00593      */
00594 
00595     /* Contruct a new string converting from the spcified data source into
00596        a string array.
00597      */
00598     PString(
00599       ConversionType type,  
00600       const char * str,    
00601       ...                 
00602     );
00603     PString(
00604       ConversionType type,  
00605       long value,           
00606       unsigned base = 10    
00607     );
00608     PString(
00609       ConversionType type,  
00610       double value,         
00611       unsigned places       
00612     );
00613 
00621     PString & operator=(
00622       const PString & str  
00623     );
00624 
00634     PString & operator=(
00635       const char * cstr  
00636     );
00637 
00646     PString & operator=(
00647       char ch            
00648     );
00649 
00654     PString & operator=(
00655       short n   
00656     );
00657 
00662     PString & operator=(
00663       unsigned short n   
00664     );
00665 
00670     PString & operator=(
00671       int n   
00672     );
00673 
00678     PString & operator=(
00679       unsigned int n   
00680     );
00681 
00686     PString & operator=(
00687       long n   
00688     );
00689 
00694     PString & operator=(
00695       unsigned long n   
00696     );
00697 
00702     PString & operator=(
00703       PInt64 n   
00704     );
00705 
00710     PString & operator=(
00711       PUInt64 n   
00712     );
00713 
00716     virtual PString & MakeEmpty();
00717 
00720     static PString Empty();
00722 
00729     virtual PObject * Clone() const;
00730 
00740     virtual Comparison Compare(
00741       const PObject & obj   
00742     ) const;
00743 
00746     virtual void PrintOn(
00747       ostream & strm  
00748     ) const;
00749 
00755     virtual void ReadFrom(
00756       istream & strm  
00757     );
00758 
00772     virtual PINDEX HashFunction() const;
00774 
00789     virtual BOOL SetSize(
00790       PINDEX newSize  
00791     );
00792 
00801     virtual BOOL IsEmpty() const;
00802 
00811     virtual BOOL MakeUnique();
00813 
00814 
00827     BOOL MakeMinimumSize();
00828 
00837     PINLINE PINDEX GetLength() const;
00838 
00845     bool operator!() const;
00847 
00856     PString operator+(
00857       const PString & str   
00858     ) const;
00859 
00871     PString operator+(
00872       const char * cstr  
00873     ) const;
00874 
00886     PString operator+(
00887       char ch   
00888     ) const;
00889 
00901     friend PString operator+(
00902       const char * cstr,    
00903       const PString & str   
00904     );
00905 
00917     friend PString operator+(
00918       char  c,              
00919       const PString & str   
00920     );
00921 
00927     PString & operator+=(
00928       const PString & str   
00929     );
00930 
00940     PString & operator+=(
00941       const char * cstr  
00942     );
00943 
00953     PString & operator+=(
00954       char ch   
00955     );
00956 
00957 
00964     PString operator&(
00965       const PString & str   
00966     ) const;
00967 
00984     PString operator&(
00985       const char * cstr  
00986     ) const;
00987 
01004     PString operator&(
01005       char ch   
01006     ) const;
01007 
01024     friend PString operator&(
01025       const char * cstr,    
01026       const PString & str   
01027     );
01028 
01045     friend PString operator&(
01046       char  ch,              
01047       const PString & str   
01048     );
01049 
01055     PString & operator&=(
01056       const PString & str   
01057     );
01058 
01073     PString & operator&=(
01074       const char * cstr  
01075     );
01076 
01077 
01092     PString & operator&=(
01093       char ch  
01094     );
01096 
01097 
01105     bool operator*=(
01106       const PString & str  
01107     ) const;
01108 
01116     bool operator==(
01117       const PObject & str  
01118     ) const;
01119 
01127     bool operator!=(
01128       const PObject & str  
01129     ) const;
01130 
01138     bool operator<(
01139       const PObject & str  
01140     ) const;
01141 
01149     bool operator>(
01150       const PObject & str  
01151     ) const;
01152 
01160     bool operator<=(
01161       const PObject & str  
01162     ) const;
01163 
01171     bool operator>=(
01172       const PObject & str  
01173     ) const;
01174 
01175 
01186     bool operator*=(
01187       const char * cstr  
01188     ) const;
01189 
01200     bool operator==(
01201       const char * cstr  
01202     ) const;
01203 
01214     bool operator!=(
01215       const char * cstr  
01216     ) const;
01217 
01228     bool operator<(
01229       const char * cstr  
01230     ) const;
01231 
01242     bool operator>(
01243       const char * cstr  
01244     ) const;
01245 
01256     bool operator<=(
01257       const char * cstr  
01258     ) const;
01259 
01270     bool operator>=(
01271       const char * cstr  
01272     ) const;
01273 
01285     Comparison NumCompare(
01286       const PString & str,        
01287       PINDEX count = P_MAX_INDEX, 
01288       PINDEX offset = 0           
01289     ) const;
01290 
01302     Comparison NumCompare(
01303       const char * cstr,          
01304       PINDEX count = P_MAX_INDEX, 
01305       PINDEX offset = 0           
01306     ) const;
01308 
01309 
01313     PINDEX Find(
01314       char ch,              
01315       PINDEX offset = 0     
01316     ) const;
01317 
01319     PINDEX Find(
01320       const PString & str,  
01321       PINDEX offset = 0     
01322     ) const;
01323 
01324     /* Locate the position within the string of the character or substring. The
01325        search will begin at the character offset provided.
01326        
01327        If #offset# is beyond the length of the string, then the
01328        function will always return #P_MAX_INDEX#.
01329        
01330        The matching will be for identical character or string. If a search
01331        ignoring case is required then the string should be converted to a
01332        #PCaselessString# before the search is made.
01333 
01334        @return
01335        position of character or substring in the string, or P_MAX_INDEX if the
01336        character or substring is not in the string.
01337      */
01338     PINDEX Find(
01339       const char * cstr,    
01340       PINDEX offset = 0     
01341     ) const;
01342 
01344     PINDEX FindLast(
01345       char ch,                     
01346       PINDEX offset = P_MAX_INDEX  
01347     ) const;
01348 
01350     PINDEX FindLast(
01351       const PString & str,         
01352       PINDEX offset = P_MAX_INDEX  
01353     ) const;
01354 
01372     PINDEX FindLast(
01373       const char * cstr,           
01374       PINDEX offset = P_MAX_INDEX  
01375     ) const;
01376 
01378     PINDEX FindOneOf(
01379       const PString & set,  
01380       PINDEX offset = 0     
01381     ) const;
01382 
01397     PINDEX FindOneOf(
01398       const char * cset,    
01399       PINDEX offset = 0     
01400     ) const;
01401 
01403     PINDEX FindSpan(
01404       const PString & set,  
01405       PINDEX offset = 0     
01406     ) const;
01407 
01423     PINDEX FindSpan(
01424       const char * cset,    
01425       PINDEX offset = 0     
01426     ) const;
01427 
01438     PINDEX FindRegEx(
01439       const PRegularExpression & regex, 
01440       PINDEX offset = 0                 
01441     ) const;
01442 
01453     BOOL FindRegEx(
01454       const PRegularExpression & regex, 
01455       PINDEX & pos,                     
01456       PINDEX & len,                     
01457       PINDEX offset = 0,                
01458       PINDEX maxPos = P_MAX_INDEX       
01459     ) const;
01460 
01461 
01472     void Replace(
01473       const PString & target,   
01474       const PString & subs,     
01475       BOOL all = FALSE,         
01476       PINDEX offset = 0         
01477     );
01478 
01486     void Splice(
01487       const PString & str,  
01488       PINDEX pos,           
01489       PINDEX len = 0        
01490     );
01491 
01499     void Splice(
01500       const char * cstr,    
01501       PINDEX pos,           
01502       PINDEX len = 0        
01503     );
01504 
01511     void Delete(
01512       PINDEX start,   
01513       PINDEX len      
01514     );
01516 
01517 
01537     PString operator()(
01538       PINDEX start,  
01539       PINDEX end     
01540     ) const;
01541 
01556     PString Left(
01557       PINDEX len   
01558     ) const;
01559 
01574     PString Right(
01575       PINDEX len   
01576     ) const;
01577 
01594     PString Mid(
01595       PINDEX start,             
01596       PINDEX len = P_MAX_INDEX  
01597     ) const;
01598 
01599 
01607     PString LeftTrim() const;
01608 
01616     PString RightTrim() const;
01617 
01626     PString Trim() const;
01627 
01628 
01637     PString ToLower() const;
01638 
01647     PString ToUpper() const;
01648 
01649 
01651     PStringArray Tokenise(
01652       const PString & separators,
01654       BOOL onePerSeparator = TRUE
01656     ) const;
01681     PStringArray Tokenise(
01682       const char * cseparators,
01684       BOOL onePerSeparator = TRUE
01686     ) const;
01687 
01701     PStringArray Lines() const;
01703 
01720     PString & sprintf(
01721       const char * cfmt,   
01722       ...                  
01723     );
01724 
01739     friend PString psprintf(
01740       const char * cfmt,   
01741       ...                  
01742     );
01743 
01745     PString & vsprintf(
01746       const PString & fmt, 
01747       va_list args         
01748     );
01763     PString & vsprintf(
01764       const char * cfmt,   
01765       va_list args         
01766     );
01767 
01769     friend PString pvsprintf(
01770       const char * cfmt,   
01771       va_list args         
01772     );
01787     friend PString pvsprintf(
01788       const PString & fmt, 
01789       va_list args         
01790     );
01791 
01792 
01805     long AsInteger(
01806       unsigned base = 10    
01807     ) const;
01820     DWORD AsUnsigned(
01821       unsigned base = 10    
01822     ) const;
01836     PInt64 AsInt64(
01837       unsigned base = 10    
01838     ) const;
01852     PUInt64 AsUnsigned64(
01853       unsigned base = 10    
01854     ) const;
01855 
01866     double AsReal() const;
01867      
01871     PWORDArray AsUCS2() const;
01872 
01883     PBYTEArray ToPascal() const;
01884 
01893     PString ToLiteral() const;
01894 
01902     operator const unsigned char *() const;
01903 
01906     operator std::string () const
01907     { return std::string(theArray); }
01908 
01911 #ifdef _WIN32_WCE
01912         operator LPCWSTR() const
01913     { return AsUCS2(); }
01914 #endif
01915 
01916 
01917 
01918   protected:
01919     void InternalFromUCS2(
01920       const WORD * ptr,
01921       PINDEX len
01922     );
01923     virtual Comparison InternalCompare(
01924       PINDEX offset,      // Offset into string to compare.
01925       char c              // Character to compare against.
01926     ) const;
01927     virtual Comparison InternalCompare(
01928       PINDEX offset,      // Offset into string to compare.
01929       PINDEX length,      // Number of characters to compare.
01930       const char * cstr   // C string to compare against.
01931     ) const;
01932     /* Internal function to compare the current string value against the
01933        specified C string.
01934 
01935        @return
01936        relative rank of the two strings.
01937      */
01938 
01939     PString(int dummy, const PString * str);
01940 };
01941 
01942 
01943 inline ostream & operator<<(ostream & stream, const PString & string)
01944 {
01945   string.PrintOn(stream);
01946   return stream;
01947 }
01948 
01949 
01951 
01961 class PCaselessString : public PString
01962 {
01963   PCLASSINFO(PCaselessString, PString);
01964 
01965   public:
01968     PCaselessString();
01969 
01973     PCaselessString(
01974       const char * cstr   
01975     );
01976 
01981     PCaselessString(
01982       const PString & str  
01983     );
01984 
01985 
01988     PCaselessString(
01989       const std::string & str  
01990       ) : PString(str)
01991     { }
01992 
02000     PCaselessString & operator=(
02001       const PString & str  
02002     );
02003 
02013     PCaselessString & operator=(
02014       const char * cstr  
02015     );
02016 
02025     PCaselessString & operator=(
02026       char ch            
02027     );
02028 
02029 
02030   // Overrides from class PObject
02035     virtual PObject * Clone() const;
02036 
02037   protected:
02038   // Overrides from class PString
02039     virtual Comparison InternalCompare(
02040       PINDEX offset,      // Offset into string to compare.
02041       char c              // Character to compare against.
02042     ) const;
02043     virtual Comparison InternalCompare(
02044       PINDEX offset,      // Offset into string to compare.
02045       PINDEX length,      // Number of characters to compare.
02046       const char * cstr   // C string to compare against.
02047     ) const;
02048     /* Internal function to compare the current string value against the
02049        specified C string.
02050 
02051        @return
02052        relative rank of the two strings or characters.
02053      */
02054 
02055     PCaselessString(int dummy, const PCaselessString * str);
02056 };
02057 
02059 
02060 class PStringStream;
02061 
02068 class PStringStream : public PString, public iostream
02069 {
02070   PCLASSINFO(PStringStream, PString);
02071 
02072   public:
02078     PStringStream();
02079 
02084     PStringStream(
02085       PINDEX fixedBufferSize
02086     );
02087 
02094     PStringStream(
02095       const PString & str   
02096     );
02097 
02102     PStringStream(
02103       const char * cstr   
02104     );
02105 
02108     virtual PString & MakeEmpty();
02109 
02121     PStringStream & operator=(
02122       const PStringStream & strm
02123     );
02124 
02136     PStringStream & operator=(
02137       const PString & str  
02138     );
02139 
02155     PStringStream & operator=(
02156       const char * cstr  
02157     );
02158 
02167     PStringStream & operator=(
02168       char ch            
02169     );
02170 
02171 
02173     virtual ~PStringStream();
02174 
02175 
02176   protected:
02177     virtual void AssignContents(const PContainer & cont);
02178 
02179   private:
02180     PStringStream(int, const PStringStream &) : iostream(cout.rdbuf()) { }
02181 
02182     class Buffer : public streambuf {
02183       public:
02184         Buffer(PStringStream & str, PINDEX size);
02185         Buffer(const Buffer & sbuf);
02186         Buffer & operator=(const Buffer & sbuf);
02187         virtual int overflow(int=EOF);
02188         virtual int underflow();
02189         virtual int sync();
02190 #ifdef __USE_STL__
02191         virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
02192         virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
02193 #else
02194         virtual streampos seekoff(streamoff, ios::seek_dir, int);
02195 #endif
02196         PStringStream & string;
02197         BOOL            fixedBufferSize;
02198     };
02199 };
02200 
02201 
02202 class PStringList;
02203 class PSortedStringList;
02204 
02217 #ifdef DOC_PLUS_PLUS
02218 class PStringArray : public PArray {
02219 #endif
02220   PDECLARE_ARRAY(PStringArray, PString);
02221   public:
02228     PStringArray(
02229       PINDEX count,                 
02230       char const * const * strarr,  
02231       BOOL caseless = FALSE         
02232     );
02235     PStringArray(
02236       const PString & str  
02237     );
02240     PStringArray(
02241       const PStringList & list  
02242     );
02245     PStringArray(
02246       const PSortedStringList & list  
02247     );
02248 
02252     PStringArray(
02253       const std::vector<PString> & vec
02254     )
02255     {
02256       for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02257         AppendString(*r);
02258     }
02259 
02263     PStringArray(
02264       const std::vector<std::string> & vec
02265     )
02266     {
02267       for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
02268         AppendString(PString(*r));
02269     }
02270 
02274     template <typename stlContainer>
02275     static PStringArray container(
02276       const stlContainer & vec
02277     )
02278     {
02279       PStringArray list;
02280       for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02281         list.AppendString(PString(*r));
02282       return list;
02283     }
02284 
02286 
02294     virtual void ReadFrom(
02295       istream &strm   // Stream to read the objects contents from.
02296     );
02298 
02307     PINDEX GetStringsIndex(
02308       const PString & str 
02309     ) const;
02310 
02311     PString operator[](
02312       PINDEX index  
02313     ) const;
02314 
02322     PString & operator[](
02323       PINDEX index  
02324     );
02325 
02328     PINDEX AppendString(
02329       const PString & str 
02330     );
02331 
02337     PStringArray & operator +=(const PStringArray & array);
02338     PStringArray & operator +=(const PString & str);
02339 
02340 
02347     PStringArray operator + (const PStringArray & array);
02348     PStringArray operator + (const PString & str);
02349 
02357     char ** ToCharArray(
02358       PCharArray * storage = NULL
02359     ) const;
02361 };
02362 
02363 
02376 #ifdef DOC_PLUS_PLUS
02377 class PStringList : public PList {
02378 #endif
02379 PDECLARE_LIST(PStringList, PString);
02380   public:
02385     PStringList(
02386       PINDEX count,                 
02387       char const * const * strarr,  
02388       BOOL caseless = FALSE         
02389     );
02392     PStringList(
02393       const PString & str  
02394     );
02397     PStringList(
02398       const PStringArray & array  
02399     );
02402     PStringList(
02403       const PSortedStringList & list  
02404     );
02406 
02414     virtual void ReadFrom(
02415       istream &strm   // Stream to read the objects contents from.
02416     );
02418 
02423     PINDEX AppendString(
02424       const PString & str 
02425     );
02426 
02429     PINDEX InsertString(
02430       const PString & before,   
02431       const PString & str       
02432     );
02433 
02437     PINDEX GetStringsIndex(
02438       const PString & str   
02439     ) const;
02440 
02446     PStringList & operator +=(const PStringList & list);
02447     PStringList & operator +=(const PString & str);
02448 
02449 
02456     PStringList operator + (const PStringList & array);
02457     PStringList operator + (const PString & str);
02458 
02462     template <typename stlContainer>
02463     static PStringList container(
02464       const stlContainer & vec
02465     )
02466     {
02467       PStringList list;
02468       for (typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
02469         list.AppendString(PString(*r));
02470       return list;
02471     }
02473 };
02474 
02475 
02488 #ifdef DOC_PLUS_PLUS
02489 class PSortedStringList : public PSortedList {
02490 #endif
02491 PDECLARE_SORTED_LIST(PSortedStringList, PString);
02492   public:
02497     PSortedStringList(
02498       PINDEX count,                 
02499       char const * const * strarr,  
02500       BOOL caseless = FALSE         
02501     );
02504     PSortedStringList(
02505       const PString & str  
02506     );
02509     PSortedStringList(
02510       const PStringArray & array  
02511     );
02514     PSortedStringList(
02515       const PStringList & list  
02516     );
02518 
02526     virtual void ReadFrom(
02527       istream &strm   // Stream to read the objects contents from.
02528     );
02530 
02536     PINDEX AppendString(
02537       const PString & str 
02538     );
02539 
02543     PINDEX GetStringsIndex(
02544       const PString & str   
02545     ) const;
02546 
02551     PINDEX GetNextStringsIndex(
02552       const PString & str   
02553     ) const;
02555 
02556   protected:
02557     PINDEX InternalStringSelect(
02558       const char * str,
02559       PINDEX len,
02560       Element * thisElement
02561     ) const;
02562 };
02563 
02564 
02581 #ifdef DOC_PLUS_PLUS
02582 class PStringSet : public PSet {
02583 #endif
02584 PDECLARE_SET(PStringSet, PString, TRUE);
02585   public:
02590     PStringSet(
02591       PINDEX count,                 
02592       char const * const * strarr,  
02593       BOOL caseless = FALSE         
02594     );
02597     PStringSet(
02598       const PString & str  
02599     );
02601 
02609     virtual void ReadFrom(
02610       istream &strm   
02611     );
02613 
02617     void Include(
02618       const PString & key 
02619     );
02621     PStringSet & operator+=(
02622       const PString & key 
02623     );
02625     void Exclude(
02626       const PString & key 
02627     );
02629     PStringSet & operator-=(
02630       const PString & key 
02631     );
02633 };
02634 
02635 
02636 #ifdef PHAS_TEMPLATES
02637 
02645 template <class K> class PStringDictionary : public PAbstractDictionary
02646 {
02647   PCLASSINFO(PStringDictionary, PAbstractDictionary);
02648 
02649   public:
02658     PStringDictionary()
02659       : PAbstractDictionary() { }
02661 
02668     virtual PObject * Clone() const
02669       { return PNEW PStringDictionary(0, this); }
02671 
02686     const PString & operator[](const K & key) const
02687       { return (const PString &)GetRefAt(key); }
02688 
02702     PString operator()(const K & key, const char * dflt = "") const
02703       { if (AbstractContains(key)) return (*this)[key]; return dflt; }
02704 
02713     BOOL Contains(
02714       const K & key   // Key to look for in the dictionary.
02715       ) const { return AbstractContains(key); }
02716 
02728     virtual PString * RemoveAt(
02729       const K & key   // Key for position in dictionary to get object.
02730     ) {
02731         PString * s = GetAt(key); AbstractSetAt(key, NULL);
02732         return reference->deleteObjects ? (s ? (PString *)-1 : NULL) : s;
02733       }
02734 
02741     virtual PString * GetAt(
02742       const K & key   // Key for position in dictionary to get object.
02743     ) const { return (PString *)AbstractGetAt(key); }
02744 
02753     virtual BOOL SetDataAt(
02754       PINDEX index,        // Ordinal index in the dictionary.
02755       const PString & str  // New string value to put into the dictionary.
02756     ) { return PAbstractDictionary::SetDataAt(index, PNEW PString(str)); }
02757 
02769     virtual BOOL SetAt(
02770       const K & key,       // Key for position in dictionary to add object.
02771       const PString & str  // New string value to put into the dictionary.
02772     ) { return AbstractSetAt(key, PNEW PString(str)); }
02773 
02785     const K & GetKeyAt(PINDEX index) const
02786       { return (const K &)AbstractGetKeyAt(index); }
02787 
02799     PString & GetDataAt(PINDEX index) const
02800       { return (PString &)AbstractGetDataAt(index); }
02802 
02803   protected:
02804     PStringDictionary(int dummy, const PStringDictionary * c)
02805       : PAbstractDictionary(dummy, c) { }
02806 };
02807 
02808 
02823 #define PDECLARE_STRING_DICTIONARY(cls, K) \
02824   PDECLARE_CLASS(cls, PStringDictionary<K>) \
02825   protected: \
02826     cls(int dummy, const cls * c) \
02827       : PStringDictionary<K>(dummy, c) { } \
02828   public: \
02829     cls() \
02830       : PStringDictionary<K>() { } \
02831     virtual PObject * Clone() const \
02832       { return PNEW cls(0, this); } \
02833 
02834 
02847 #define PSTRING_DICTIONARY(cls, K) typedef PStringDictionary<K> cls
02848 
02849 
02850 #else // PHAS_TEMPLATES
02851 
02852 
02853 #define PSTRING_DICTIONARY(cls, K) \
02854   class cls : public PAbstractDictionary { \
02855   PCLASSINFO(cls, PAbstractDictionary) \
02856   protected: \
02857     inline cls(int dummy, const cls * c) \
02858       : PAbstractDictionary(dummy, c) { } \
02859   public: \
02860     inline cls() \
02861       : PAbstractDictionary() { } \
02862     inline PObject * Clone() const \
02863       { return PNEW cls(0, this); } \
02864     inline PString & operator[](const K & key) const \
02865       { return (PString &)GetRefAt(key); } \
02866     inline PString operator()(const K & key, const char * dflt = "") const \
02867       { if (Contains(key)) return (PString &)GetRefAt(key); return dflt; } \
02868     virtual BOOL Contains(const K & key) const \
02869       { return AbstractContains(key); } \
02870     virtual PString * RemoveAt(const K & key) \
02871       { PString * s = GetAt(key); AbstractSetAt(key, NULL); \
02872         return reference->deleteObjects ? (s ? (PString *)-1 : NULL) : s; } \
02873     virtual PString * GetAt(const K & key) const \
02874       { return (PString *)AbstractGetAt(key); } \
02875     virtual BOOL SetDataAt(PINDEX index, const PString & str) \
02876       { return PAbstractDictionary::SetDataAt(index,PNEW PString(str));} \
02877     virtual BOOL SetAt(const K & key, const PString & str) \
02878       { return AbstractSetAt(key, PNEW PString(str)); } \
02879     inline const K & GetKeyAt(PINDEX index) const \
02880       { return (const K &)AbstractGetKeyAt(index); } \
02881     inline PString & GetDataAt(PINDEX index) const \
02882       { return (PString &)AbstractGetDataAt(index); } \
02883   }
02884 
02885 #define PDECLARE_STRING_DICTIONARY(cls, K) \
02886   PSTRING_DICTIONARY(cls##_PTemplate, K); \
02887   PDECLARE_CLASS(cls, cls##_PTemplate) \
02888   protected: \
02889     cls(int dummy, const cls * c) \
02890       : cls##_PTemplate(dummy, c) { } \
02891   public: \
02892     cls() \
02893       : cls##_PTemplate() { } \
02894     virtual PObject * Clone() const \
02895       { return PNEW cls(0, this); } \
02896 
02897 #endif // PHAS_TEMPLATES
02898 
02899 
02914 #ifdef DOC_PLUS_PLUS
02915 class POrdinalToString : public PStringDictionary {
02916 #endif
02917 PDECLARE_STRING_DICTIONARY(POrdinalToString, POrdinalKey);
02918   public:
02921 
02922     struct Initialiser {
02924       PINDEX key;
02926       const char * value;
02927     };
02930     POrdinalToString(
02931       PINDEX count,                
02932       const Initialiser * init     
02933     );
02935 
02943     virtual void ReadFrom(
02944       istream &strm   // Stream to read the objects contents from.
02945     );
02947 };
02948 
02961 #ifdef DOC_PLUS_PLUS
02962 class PStringToOrdinal : public POrdinalDictionary {
02963 #endif
02964 PDECLARE_ORDINAL_DICTIONARY(PStringToOrdinal, PString);
02965   public:
02968 
02969     struct Initialiser {
02971       const char * key;
02973       PINDEX value;
02974     };
02977     PStringToOrdinal(
02978       PINDEX count,                
02979       const Initialiser * init,    
02980       BOOL caseless = FALSE        
02981     );
02983 
02991     virtual void ReadFrom(
02992       istream &strm   // Stream to read the objects contents from.
02993     );
02995 };
02996 
02997 
03011 #ifdef DOC_PLUS_PLUS
03012 class PStringToString : public PStringDictionary {
03013 #endif
03014 PDECLARE_STRING_DICTIONARY(PStringToString, PString);
03015   public:
03018 
03019     struct Initialiser {
03021       const char * key;
03023       const char * value;
03024     };
03027     PStringToString(
03028       PINDEX count,                
03029       const Initialiser * init,    
03030       BOOL caselessKeys = FALSE,   
03031       BOOL caselessValues = FALSE  
03032     );
03034 
03042     virtual void ReadFrom(
03043       istream &strm   // Stream to read the objects contents from.
03044     );
03046 };
03047 
03048 
03054 class PRegularExpression : public PObject
03055 {
03056   PCLASSINFO(PRegularExpression, PObject);
03057 
03058   public:
03061 
03062     enum {
03064       Extended = 1,
03066       IgnoreCase = 2,
03071       AnchorNewLine = 4
03072     };
03074     enum {
03081       NotBeginningOfLine = 1,
03083       NotEndofLine = 2
03084     };
03085 
03087     PRegularExpression();
03088 
03091     PRegularExpression(
03092       const PString & pattern,    
03093       int flags = IgnoreCase      
03094     );
03095 
03098     PRegularExpression(
03099       const char * cpattern,      
03100       int flags = IgnoreCase      
03101     );
03102 
03106     PRegularExpression(
03107       const PRegularExpression &
03108     );
03109 
03113     PRegularExpression & operator =(
03114       const PRegularExpression &
03115     );
03116 
03118     ~PRegularExpression();
03120 
03123 
03124     enum ErrorCodes {
03126       NoError = 0,    
03128       NoMatch,      
03129 
03130       // POSIX regcomp return error codes.  (In the order listed in the standard.)
03132       BadPattern,  
03134       CollateError,  
03136       BadClassType,  
03138       BadEscape,    
03140       BadSubReg,
03142       UnmatchedBracket, 
03144       UnmatchedParen,
03146       UnmatchedBrace,
03148       BadBR,        
03150       RangeError,  
03152       OutOfMemory,
03154       BadRepitition,
03155 
03156       /* Error codes we've added.  */
03158       PrematureEnd,
03160       TooBig,
03162       UnmatchedRParen,
03164       NotCompiled
03165     };
03166 
03172     ErrorCodes GetErrorCode() const;
03173 
03180     PString GetErrorText() const;
03182 
03186     BOOL Compile(
03187       const PString & pattern,    
03188       int flags = IgnoreCase      
03189     );
03197     BOOL Compile(
03198       const char * cpattern,      
03199       int flags = IgnoreCase      
03200     );
03201 
03202 
03204     BOOL Execute(
03205       const PString & str,    
03206       PINDEX & start,         
03207       int flags = 0           
03208     ) const;
03210     BOOL Execute(
03211       const PString & str,    
03212       PINDEX & start,         
03213       PINDEX & len,           
03214       int flags = 0           
03215     ) const;
03217     BOOL Execute(
03218       const char * cstr,      
03219       PINDEX & start,         
03220       int flags = 0           
03221     ) const;
03223     BOOL Execute(
03224       const char * cstr,      
03225       PINDEX & start,         
03226       PINDEX & len,           
03227       int flags = 0           
03228     ) const;
03230     BOOL Execute(
03231       const PString & str,    
03232       PIntArray & starts,     
03233       int flags = 0           
03234     ) const;
03236     BOOL Execute(
03237       const PString & str,    
03238       PIntArray & starts,     
03239       PIntArray & ends,       
03240       int flags = 0           
03241     ) const;
03243     BOOL Execute(
03244       const char * cstr,      
03245       PIntArray & starts,     
03246       int flags = 0           
03247     ) const;
03263     BOOL Execute(
03264       const char * cstr,      
03265       PIntArray & starts,     
03266       PIntArray & ends,       
03267       int flags = 0           
03268     ) const;
03270 
03279     static PString EscapeString(
03280       const PString & str     
03281     );
03283 
03284   protected:
03285     PString patternSaved;
03286     int flagsSaved;
03287 
03288     void * expression;
03289     mutable ErrorCodes lastError;
03290 };
03291 
03292 PString psprintf(const char * cfmt, ...);
03293 
03294 #endif // #ifndef __PSTRING__
03295 // End Of File ///////////////////////////////////////////////////////////////

Generated on Fri Mar 7 06:25:02 2008 for PTLib by  doxygen 1.5.1