34 #ifndef PTLIB_STRING_H
35 #define PTLIB_STRING_H
68 #if (defined(_WIN32) || defined(_WIN32_WCE)) && (!defined(_NATIVE_WCHAR_T_DEFINED)) && (!defined(__MINGW32__))
134 const std::string & str
186 const wchar_t * ustr,
201 const PWCharArray & ustr
333 const std::string & str
998 PINDEX count = P_MAX_INDEX,
1015 PINDEX count = P_MAX_INDEX,
1057 PINDEX offset = P_MAX_INDEX
1063 PINDEX offset = P_MAX_INDEX
1085 PINDEX offset = P_MAX_INDEX
1169 PINDEX maxPos = P_MAX_INDEX
1313 PINDEX len = P_MAX_INDEX
1399 const char * cseparators,
1588 PWCharArray
AsUCS2()
const;
1619 operator const unsigned char *()
const;
1623 operator std::string ()
const
1630 const wchar_t * ptr,
1657 string.PrintOn(stream);
1664 return stream << (
const char *)
string;
1669 class PWideString :
public PWCharArray {
1673 typedef const wchar_t * Initialiser;
1676 PWideString(
const PWCharArray & arr) : PWCharArray(arr) { }
1677 PWideString(
const PString & str) : PWCharArray(str.AsUCS2()) { }
1678 PWideString(
const char * str) : PWCharArray(
PString(str).AsUCS2()) { }
1679 PWideString & operator=(
const PWideString & str) { PWCharArray::operator=(str);
return *
this; }
1680 PWideString & operator=(
const PString & str) { PWCharArray::operator=(str.
AsUCS2());
return *
this; }
1681 PWideString & operator=(
const std::string & str) { PWCharArray::operator=(
PString(str.c_str()).AsUCS2());
return *
this; }
1682 PWideString & operator=(
const char * str) { PWCharArray::operator=(
PString(str).AsUCS2());
return *
this; }
1683 friend inline ostream &
operator<<(ostream & stream,
const PWideString &
string) {
return stream <<
PString(
string); }
1690 typedef PWideString PVarString;
1736 const std::string & str
1759 const std::string & str
1833 template <
class ParentString>
1840 : ParentString(m_staticReference)
1841 , m_staticReference((PINDEX)strlen(init)+1, true)
1843 this->theArray = (
char *)init;
1853 : ParentString(m_staticReference)
1854 , m_staticReference(0, true)
1895 PINDEX fixedBufferSize
1992 class Buffer :
public streambuf {
1995 Buffer(
const Buffer & sbuf);
1996 Buffer &
operator=(
const Buffer & sbuf);
1997 virtual int_type overflow(int_type = EOF);
1998 virtual int_type underflow();
2000 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
2001 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
2023 #ifdef DOC_PLUS_PLUS
2036 char const *
const * strarr,
2059 const std::vector<PString> & vec
2062 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
2070 const std::vector<std::string> & vec
2073 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
2080 template <
typename stlContainer>
2082 const stlContainer & vec
2086 for (
typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
2183 #ifdef DOC_PLUS_PLUS
2194 char const *
const * strarr,
2270 template <
typename stlContainer>
2272 const stlContainer & vec
2276 for (
typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
2295 #ifdef DOC_PLUS_PLUS
2306 char const *
const * strarr,
2390 #ifdef DOC_PLUS_PLUS
2401 char const *
const * strarr,
2523 return str != NULL ? *str :
PString(dflt);
2644 #define PDECLARE_STRING_DICTIONARY(cls, K) \
2645 PDECLARE_CLASS(cls, PStringDictionary<K>) \
2647 cls(int dummy, const cls * c) \
2648 : PStringDictionary<K>(dummy, c) { } \
2651 : PStringDictionary<K>() { } \
2652 virtual PObject * Clone() const \
2653 { return PNEW cls(0, this); } \
2668 #define PSTRING_DICTIONARY(cls, K) typedef PStringDictionary<K> cls
2685 #ifdef DOC_PLUS_PLUS
2732 #ifdef DOC_PLUS_PLUS
2783 #ifdef DOC_PLUS_PLUS
2889 bool GetBoolean(
const char * key,
bool dflt =
false)
const { PConstCaselessString k(key);
return GetBoolean(k, dflt); }
2901 long GetInteger(
const char * key,
long dflt = 0)
const { PConstCaselessString k(key);
return GetInteger(k, dflt); }
2913 double GetReal(
const char * key,
double dflt = 0)
const { PConstCaselessString k(key);
return GetReal(k, dflt); }
2919 void SetReal(
const char * key,
double value,
int decimals) { PConstCaselessString k(key);
SetReal(k, value, decimals); }
3004 const char * cpattern,
3116 const char * cpattern,
3233 #endif // PTLIB_STRING_H
PINLINE PBoolean AbstractContains(const PObject &key) const
Determine if the value of the object is contained in the hash table.
const char * value
String value for ordinal.
Definition: pstring.h:2697
long AsInteger(unsigned base=10) const
Convert the string to an integer value using the specified number base.
void SetReal(const PString &key, double value, int decimals)
Definition: pstring.h:2920
PString * GetAt(const PCaselessString &key) const
Definition: pstring.h:2861
PString * RemoveAt(const PString &key)
Definition: pstring.h:2872
char ** ToCharArray(bool withEqualSign, PCharArray *storage=NULL) const
Create an array of C strings.
virtual PBoolean MakeUnique()
Make this instance to be the one and only reference to the container contents.
__inline void Remove(const char *key)
Remove option value.
Definition: pstring.h:2947
virtual ~PStringStream()
Destroy the string stream, deleting the stream buffer.
void SetBoolean(const PCaselessString &(*key)(), bool value)
Definition: pstring.h:2898
PRegularExpression()
Create a new, empty, regular expression.
Trailing backslash.
Definition: pstring.h:3053
Not implemented.
Definition: pstring.h:3049
ErrorCodes GetErrorCode() const
Get the error code for the last Compile() or Execute() operation.
friend PString pvsprintf(const char *cfmt, va_list args)
Produce formatted output as a string.
bool GetBoolean(const char *key, bool dflt=false) const
Get the option value as a boolean.
Definition: pstring.h:2889
PString & operator&=(const PString &str)
Concatenate a string to another string, modifiying that string.
PString & operator=(const PString &str)
Assign the string to the current object.
PRegularExpression & operator=(const PRegularExpression &)
Assign a regular expression.
ostream & operator<<(ostream &stream, const PString &string)
Definition: pstring.h:1655
bool operator*=(const PString &str) const
Compare two strings using case insensitive comparison.
virtual void PrintOn(ostream &strm) const
Output the string to the specified stream.
const PString & GetPattern() const
Return the string which represents the pattern matched by the regular expression. ...
Definition: pstring.h:3098
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
Array of characters.
Definition: array.h:551
This template class maps the PAbstractDictionary to a specific key type and a PString data type...
Definition: pstring.h:2463
PINDEX value
Ordinal value for string.
Definition: pstring.h:2744
Invalid character class name.
Definition: pstring.h:3051
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PINDEX AppendString(const PString &str)
Add a string to the list.
PINDEX InternalStringSelect(const char *str, PINDEX len, Element *thisElement, Element *&lastElement) const
PStringArray & operator+=(const PStringArray &array)
Concatenate a PString or PStringArray to the array.
bool operator<=(const PObject &str) const
Compare two strings using the PObject::Compare() function.
If this bit is set, then anchors do not match at newline characters in the string.
Definition: pstring.h:2976
PBoolean SetAt(const PCaselessString &key, const PString &data)
Definition: pstring.h:2867
PStringOptions()
Definition: pstring.h:2848
PINLINE PINDEX GetLength() const
Determine the length of the null terminated string.
virtual PObject * Clone() const
Make a complete duplicate of the string.
static PStringList container(const stlContainer &vec)
Create a PStringArray from an STL container.
Definition: pstring.h:2271
void * expression
Definition: pstring.h:3228
virtual void AssignContents(const PContainer &cont)
Copy the container contents.
__inline bool Set(const PCaselessString &key, const PString &value)
Definition: pstring.h:2943
#define PAssertAlways(msg)
This macro is used to assert immediately.
Definition: object.h:229
PStringSet(PINDEX count, char const *const *strarr, PBoolean caseless=false)
Create a PStringArray from the array of C strings.
__inline bool Has(const PString &key) const
Definition: pstring.h:2926
long GetInteger(const PCaselessString &(*key)(), long dflt=0) const
Definition: pstring.h:2904
PINDEX key
Ordinal key for string.
Definition: pstring.h:2695
PCaselessString()
Create a new, empty, caseless string.
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
POrdinalToString(PINDEX count, const Initialiser *init)
Initialise the ordinal dictionary of strings from the static array.
PInt64 AsInt64(unsigned base=10) const
Convert the string to an integer value using the specified number base.
virtual PString & MakeEmpty()
Make the current string empty.
Structure for static array initialiser for class.
Definition: pstring.h:2740
PCaselessString & operator=(const PString &str)
Assign the string to the current object.
#define PINLINE
Definition: object.h:127
This class is a standard C++ stream class descendent for reading or writing streamed data to or from ...
Definition: pstring.h:1878
Definition: pstring.h:290
void Replace(const PString &target, const PString &subs, PBoolean all=false, PINDEX offset=0)
Locate the substring within the string and replace it with the specifed substring.
ErrorCodes
Error codes.
Definition: pstring.h:3039
PINDEX GetStringsIndex(const PString &str) const
Get the index of the string with the specified value.
Definition: pstring.h:284
PString & sprintf(const char *cfmt,...)
Concatenate a formatted output to the string.
PINDEX AppendString(const PString &str)
Append a string to the array.
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:2784
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
PContainer & operator=(const PContainer &cont)
Assign one container reference to another.
Invalid back reference.
Definition: pstring.h:3055
const char * key
String key for string.
Definition: pstring.h:2793
static PString EscapeString(const PString &str)
Escape all characters in the str parameter that have a special meaning within a regular expression...
virtual Comparison InternalCompare(PINDEX offset, char c) const
Definition: pstring.h:287
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
bool Contains(const PCaselessString &(*key)()) const
Definition: pstring.h:2856
PString(PContainerReference &reference)
Definition: pstring.h:1651
Premature end.
Definition: pstring.h:3073
bool operator!=(const PObject &str) const
Compare two strings using the PObject::Compare() function.
This class is a variation of a string that ignores case.
Definition: pstring.h:1708
An abstract dictionary container.
Definition: dict.h:626
__inline bool Set(const PCaselessString &(*key)(), const PString &value)
Definition: pstring.h:2944
PBYTEArray ToPascal() const
Convert a standard null terminated string to a "pascal" style string.
PString * GetAt(const PCaselessString &(*key)()) const
Definition: pstring.h:2862
void Include(const PString &key)
Include the spcified string value into the set.
PStringOptions & operator=(const PStringToString &other)
Definition: pstring.h:2850
PBoolean SetAt(const PString &key, const PString &data)
Definition: pstring.h:2866
virtual PBoolean SetSize(PINDEX)
Definition: pstring.h:1847
PString RightTrim() const
Create a string consisting of all characters from the source string except all spaces at the end of t...
PBoolean SetAt(const PCaselessString &(*key)(), const PString &data)
Definition: pstring.h:2868
char ** ToCharArray(PCharArray *storage=NULL) const
Create an array of C strings.
double GetReal(const PCaselessString &(*key)(), double dflt=0) const
Definition: pstring.h:2916
PString operator[](PINDEX index) const
PBoolean SetAt(const char *key, const PString &data)
Definition: pstring.h:2865
This is an array collection class of PString objects.
Definition: pstring.h:2024
~PRegularExpression()
Release storage for the compiled regular expression.
__inline void Remove(const PCaselessString &key)
Definition: pstring.h:2949
PConstantString< PString > PConstString
Constant PString type. See PConstantString.
Definition: pstring.h:1861
__inline bool Has(const PCaselessString &(*key)()) const
Definition: pstring.h:2928
virtual Comparison InternalCompare(PINDEX offset, char c) const
Use extended regular expressions.
Definition: pstring.h:2969
PString Right(PINDEX len) const
Extract a portion of the string into a new string.
virtual PINDEX HashFunction() const
Calculate a hash value for use in sets and dictionaries.
int flagsSaved
Definition: pstring.h:3226
PINLINE PString()
Construct an empty string.
PString patternSaved
Definition: pstring.h:3225
PString ToLiteral() const
Convert the string to C literal string format.
PBoolean Compile(const PString &pattern, int flags=IgnoreCase)
Compiler pattern.
PString * RemoveAt(const char *key)
Definition: pstring.h:2871
bool GetBoolean(const PString &key, bool dflt=false) const
Definition: pstring.h:2890
virtual void ReadFrom(istream &strm)
Input the string from the specified stream.
PStringArray operator+(const PStringArray &array)
Create a new PStringArray, and add PString or PStringArray to it a new PStringArray.
bool Contains(const PCaselessString &key) const
Definition: pstring.h:2855
Unmatched ) or \); not returned from regcomp.
Definition: pstring.h:3077
This template class maps the PAbstractList to a specific object type.
Definition: lists.h:321
void InternalFromUCS2(const wchar_t *ptr, PINDEX len)
virtual PBoolean IsEmpty() const
Determine if the string is empty.
virtual PString * RemoveAt(const K &key)
Remove an object at the specified key.
Definition: pstring.h:2549
No preceding re for repetition op.
Definition: pstring.h:3069
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
PStringArray Tokenise(const PString &separators, PBoolean onePerSeparator=true) const
Split the string into an array of substrings.
PINDEX InsertString(const PString &before, const PString &str)
Insert a string into the list.
virtual PString * GetAt(const K &key) const
Get the object at the specified key position.
Definition: pstring.h:2562
PINDEX FindSpan(const PString &set, PINDEX offset=0) const
Locate the position of character not in the set.
PStringOptions(const PStringToString &other)
Definition: pstring.h:2849
BOOL PBoolean
Definition: object.h:102
virtual Comparison Compare(const PObject &obj) const
Get the relative rank of the two strings.
PWCharArray AsUCS2() const
Convert UTF-8 string to UCS-2.
virtual PBoolean AbstractSetAt(const PObject &key, PObject *obj)
Add a new object to the collection.
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
__inline PString Get(const PCaselessString &key, const char *dflt=NULL) const
Definition: pstring.h:2933
PString & operator+=(const PString &str)
Concatenate a string to another string, modifiying that string.
PString operator()(PINDEX start, PINDEX end) const
Extract a portion of the string into a new string.
PINDEX Find(char ch, PINDEX offset=0) const
Locate the position within the string of the character.
bool Contains(const PString &key) const
Definition: pstring.h:2854
PStringList & operator+=(const PStringList &list)
Concatenate a PString or PStringArray to the list.
This is a dictionary collection class of ordinals keyed by PString objects.
Definition: pstring.h:2733
PBoolean MakeMinimumSize()
Set the actual memory block array size to the minimum required to hold the current string contents...
Array of unsigned characters.
Definition: array.h:670
Success.
Definition: pstring.h:3041
PINDEX GetNextStringsIndex(const PString &str) const
Get the index of the next string after specified value.
__inline void Remove(const PString &key)
Definition: pstring.h:2948
ConversionType
Definition: pstring.h:281
virtual PBoolean SetDataAt(PINDEX index, const PString &str)
Set the data at the specified ordinal index position in the dictionary.
Definition: pstring.h:2574
Specialised version of PStringToString to contain a dictionary of options/attributes.
Definition: pstring.h:2845
long GetInteger(const PString &key, long dflt=0) const
Definition: pstring.h:2902
PStringToString(PINDEX count, const Initialiser *init, PBoolean caselessKeys=false, PBoolean caselessValues=false)
Initialise the string dictionary of strings from the static array.
PString & GetDataAt(PINDEX index) const
Get the data in the dictionary at the ordinal index position.
Definition: pstring.h:2620
This is a sorted list collection class of PString objects.
Definition: pstring.h:2296
PStringToOrdinal(PINDEX count, const Initialiser *init, PBoolean caseless=false)
Initialise the string dictionary of ordinals from the static array.
Ignore case in search.
Definition: pstring.h:2971
void SetBoolean(const char *key, bool value)
Set the option value as a boolean.
Definition: pstring.h:2895
const K & GetKeyAt(PINDEX index) const
Get the key in the dictionary at the ordinal index position.
Definition: pstring.h:2606
Create a constant string.
Definition: pstring.h:1834
virtual PObject * AbstractGetAt(const PObject &key) const
Get the object at the specified key position.
Definition: pstring.h:285
PString * GetAt(const char *key) const
Definition: pstring.h:2859
char * theArray
Pointer to the allocated block of memory.
Definition: array.h:245
Definition: pstring.h:289
PStringArray(PINDEX count, char const *const *strarr, PBoolean caseless=false)
Create a PStringArray from the array of C strings.
__inline bool Set(const char *key, const PString &value)
Set the option value.
Definition: pstring.h:2941
const char * value
String value for string.
Definition: pstring.h:2795
const PString & operator[](const K &key) const
Get the string contained in the dictionary at the key position.
Definition: pstring.h:2504
Like NotBeginningOfLine, except for the end-of-line.
Definition: pstring.h:2988
virtual PBoolean MakeUnique()
Make this instance to be the one and only reference to the container contents.
virtual PBoolean SetDataAt(PINDEX index, PObject *obj)
Set the data at the specified ordinal index position in the dictionary.
PCaselessString(PContainerReference &reference)
Definition: pstring.h:1814
PStringArray(const std::vector< PString > &vec)
Create a PStringArray from a vector of PStrings.
Definition: pstring.h:2058
PStringDictionary()
Create a new, empty, dictionary.
Definition: pstring.h:2476
PString Trim() const
Create a string consisting of all characters from the source string except all spaces at the beginnin...
Definition: pstring.h:282
Comparison NumCompare(const PString &str, PINDEX count=P_MAX_INDEX, PINDEX offset=0) const
Compare a string against a substring of the object.
Structure for static array initialiser for class.
Definition: pstring.h:2791
void Splice(const PString &str, PINDEX pos, PINDEX len=0)
Splice the string into the current string at the specified position.
Invalid range end.
Definition: pstring.h:3065
__inline PString Get(const PCaselessString &(*key)(), const char *dflt=NULL) const
Definition: pstring.h:2934
DWORD AsUnsigned(unsigned base=10) const
Convert the string to an integer value using the specified number base.
PString GetString(const PCaselessString &(*key)(), const char *dflt=NULL) const
Definition: pstring.h:2880
bool operator==(const PObject &str) const
Compare two strings using the PObject::Compare() function.
PStringList(PINDEX count, char const *const *strarr, PBoolean caseless=false)
Create a PStringList from the array of C strings.
void Exclude(const PString &key)
Exclude the spcified string value from the set.
void Delete(PINDEX start, PINDEX len)
Remove the substring from the string.
This template class maps the PAbstractSet to a specific object type.
Definition: dict.h:455
virtual PObject * Clone() const
Make a complete duplicate of the string.
PString operator()(const K &key, const char *dflt=NULL) const
Get the string contained in the dictionary at the key position.
Definition: pstring.h:2520
PString & operator=(const std::string &str)
Assign the string to the current object.
Definition: pstring.h:332
PINDEX AppendString(const PString &str)
Append a string to the list.
PINDEX GetStringsIndex(const PString &str) const
Get the index of the string with the specified value.
PString * GetAt(const PString &key) const
Definition: pstring.h:2860
__inline bool Set(const PString &key, const PString &value)
Definition: pstring.h:2942
The character string class.
Definition: pstring.h:108
bool SetString(const char *key, const PString &value)
Set the option value.
Definition: pstring.h:2883
This is a set collection class of PString objects.
Definition: pstring.h:2391
PString pvsprintf(const char *fmt, va_list arg)
The same as the standard C vsnprintf(fmt, 1000, va_list arg), but returns a PString instead of a cons...
PString operator&(const PString &str) const
Concatenate two strings to produce a third.
Unmatched left bracket.
Definition: pstring.h:3057
const char * Initialiser
Definition: pstring.h:115
static PString Empty()
Return an empty string.
const char * key
String key for ordinal.
Definition: pstring.h:2742
virtual void DestroyReference()
Definition: pstring.h:1849
bool deleteObjects
Definition: contain.h:72
PString * RemoveAt(const PCaselessString &key)
Definition: pstring.h:2873
virtual PBoolean SetAt(const K &key, const PString &str)
Add a new object to the collection.
Definition: pstring.h:2590
Invalid pattern.
Definition: pstring.h:3047
PCaselessString & operator=(const std::string &str)
Assign the string to the current object.
Definition: pstring.h:1758
PStringDictionary(int dummy, const PStringDictionary *c)
Definition: pstring.h:2625
virtual PString & MakeEmpty()
Make the current string empty.
bool GetBoolean(const PCaselessString &(*key)(), bool dflt=false) const
Definition: pstring.h:2892
__inline PString Get(const PString &key, const char *dflt=NULL) const
Definition: pstring.h:2932
void SetBoolean(const PCaselessString &key, bool value)
Definition: pstring.h:2897
Abstract class to embody the base functionality of a container.
Definition: contain.h:104
This is a list collection class of PString objects.
Definition: pstring.h:2184
Definition: pstring.h:286
PString GetString(const PString &key, const char *dflt=NULL) const
Definition: pstring.h:2878
__inline bool Has(const PCaselessString &key) const
Definition: pstring.h:2927
PINDEX FindOneOf(const PString &set, PINDEX offset=0) const
Locate the position of one of the characters in the set.
bool operator<(const PObject &str) const
Compare two strings using the PObject::Compare() function.
Definition: pstring.h:288
PStringSet & operator-=(const PString &key)
Exclude the spcified string value from the set.
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
void SetReal(const PCaselessString &(*key)(), double value, int decimals)
Definition: pstring.h:2922
PString ToUpper() const
Create a string consisting of all characters from the source string with all lower case letters conve...
__inline PString Get(const char *key, const PString &dflt) const
Definition: pstring.h:2935
PBASEARRAY(PWCharArray, wchar_t)
bool operator>=(const PObject &str) const
Compare two strings using the PObject::Compare() function.
__inline PString Get(const PString &key, const PString &dflt) const
Definition: pstring.h:2936
PString GetErrorText() const
Get the text description for the error of the last Compile() or Execute() operation.
PStringStream & operator=(const PStringStream &strm)
Assign the string part of the stream to the current object.
This template class maps the PAbstractSortedList to a specific object type.
Definition: lists.h:954
void SetBoolean(const PString &key, bool value)
Definition: pstring.h:2896
bool SetString(const PCaselessString &(*key)(), const PString &value)
Definition: pstring.h:2886
virtual void ReadFrom(istream &strm)
Input the contents of the object from the stream.
void SetReal(const char *key, double value, int decimals)
Set a floating point real value for the particular MIME info field.
Definition: pstring.h:2919
Invalid parameter was passed to a function.
Definition: object.h:159
~PConstantString()
Definition: pstring.h:1845
Didn't find a match (for regexec).
Definition: pstring.h:3043
virtual PObject & GetRefAt(const PObject &key) const
Get the object at the specified key position.
PConstantString(typename ParentString::Initialiser init)
Definition: pstring.h:1839
Parenthesis imbalance.
Definition: pstring.h:3059
PString GetString(const char *key, const char *dflt=NULL) const
Get an option value.
Definition: pstring.h:2877
virtual const PObject & AbstractGetKeyAt(PINDEX index) const
Get the key in the hash table at the ordinal index position.
This is a dictionary collection class of PString objects, keyed by an ordinal value.
Definition: pstring.h:2686
PBoolean Contains(const K &key) const
Determine if the value of the object is contained in the hash table.
Definition: pstring.h:2534
static PStringArray container(const stlContainer &vec)
Create a PStringArray from an STL container.
Definition: pstring.h:2081
PString LeftTrim() const
Create a string consisting of all characters from the source string except all spaces at the beginnin...
void SetInteger(const PCaselessString &(*key)(), long value)
Definition: pstring.h:2910
PStringList operator+(const PStringList &array)
Create a new PStringList, and add PString or PStringList to it a new PStringList. ...
This template class maps the PArrayObjects to a specific object type.
Definition: array.h:1024
PStringSet & operator+=(const PString &key)
Include the spcified string value into the set.
PConstantString< PCaselessString > PConstCaselessString
Constant PCaselessString type. See PConstantString.
Definition: pstring.h:1864
A class representing a regular expression that may be used for locating patterns in strings...
Definition: pstring.h:2959
PINDEX FindRegEx(const PRegularExpression ®ex, PINDEX offset=0) const
Locate the position within the string of one of the regular expression.
virtual void AssignContents(const PContainer &)
Definition: pstring.h:1848
PStringArray(const std::vector< std::string > &vec)
Create a PStringArray from a vector of std::string.
Definition: pstring.h:2069
bool Contains(const char *key) const
Determine if the specified key is present.
Definition: pstring.h:2853
Definition: pstring.h:283
bool SetString(const PString &key, const PString &value)
Definition: pstring.h:2884
PStringArray Lines() const
Split the string into individual lines.
void SetInteger(const char *key, long value)
Set an integer value for the particular MIME info field.
Definition: pstring.h:2907
__inline PString Get(const PCaselessString &key, const PString &dflt) const
Definition: pstring.h:2937
bool SetString(const PCaselessString &key, const PString &value)
Definition: pstring.h:2885
PUInt64 AsUnsigned64(unsigned base=10) const
Convert the string to an integer value using the specified number base.
double AsReal() const
Convert the string to a floating point number.
PString * RemoveAt(const PCaselessString &(*key)())
Definition: pstring.h:2874
__inline void Remove(const PCaselessString &(*key)())
Definition: pstring.h:2950
__inline PString Get(const char *key, const char *dflt=NULL) const
Get the option value.
Definition: pstring.h:2931
Miscellaneous error.
Definition: pstring.h:3079
PINDEX GetStringsIndex(const PString &str) const
As for GetValuesIndex() but takes a PString argument so that literals will be automatically converted...
PString operator+(const PString &str) const
Concatenate two strings to produce a third.
virtual PObject * Clone() const
Make a complete duplicate of the dictionary.
Definition: pstring.h:2486
bool operator!() const
Determine if the string is NOT empty.
__inline bool Has(const char *key) const
Determine of the option exists.
Definition: pstring.h:2925
virtual PBoolean SetSize(PINDEX newSize)
Set the size of the string.
ErrorCodes lastError
Definition: pstring.h:3229
bool operator>(const PObject &str) const
Compare two strings using the PObject::Compare() function.
PString & vsprintf(const PString &fmt, va_list args)
Concatenate a formatted output to the string.
Unmatched \.
Definition: pstring.h:3061
Invalid contents of \.
Definition: pstring.h:3063
PINDEX FindLast(char ch, PINDEX offset=P_MAX_INDEX) const
Locate the position of the last matching character.
PString Mid(PINDEX start, PINDEX len=P_MAX_INDEX) const
Extract a portion of the string into a new string.
PContainerReference * reference
Definition: contain.h:291
Array of integers.
Definition: array.h:616
__inline PString Get(const PCaselessString &(*key)(), const PString &dflt) const
Definition: pstring.h:2938
virtual PObject & AbstractGetDataAt(PINDEX index) const
Get the data in the hash table at the ordinal index position.
double GetReal(const char *key, double dflt=0) const
Get the option value as a floating point real.
Definition: pstring.h:2913
PString psprintf(const char *fmt,...)
The same as the standard C snprintf(fmt, 1000, ...), but returns a PString instead of a const char *...
This template class maps the PAbstractDictionary to a specific key type and a POrdinalKey data type...
Definition: dict.h:1039
PBoolean Execute(const PString &str, PINDEX &start, int flags=0) const
Execute regular expression.
PBoolean MatchesRegEx(const PRegularExpression ®ex) const
Return true if the entire string matches the regular expression.
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PSortedStringList(PINDEX count, char const *const *strarr, PBoolean caseless=false)
Create a PStringArray from the array of C strings.
virtual void PrintOn(ostream &strm) const
Output the regular expression to the specified stream.
PStringStream()
Create a new, empty, string stream.
Compiled pattern bigger than 2^16 bytes.
Definition: pstring.h:3075
void SetInteger(const PString &key, long value)
Definition: pstring.h:2908
PString Left(PINDEX len) const
Extract a portion of the string into a new string.
#define PNEW
Macro for overriding system default new operator.
Definition: object.h:890
friend PString psprintf(const char *cfmt,...)
Produce formatted output as a string.
PCaselessString(const std::string &str)
Create a caseless string from a std::string.
Definition: pstring.h:1735
Structure for static array initialiser for class.
Definition: pstring.h:2693
This class is used when an ordinal index value is the key for PSet and PDictionary classes...
Definition: dict.h:50
Ran out of memory.
Definition: pstring.h:3067
If this bit is set, then the beginning-of-line operator doesn't match the beginning of the string (pr...
Definition: pstring.h:2986
double GetReal(const PString &key, double dflt=0) const
Definition: pstring.h:2914
PString ToLower() const
Create a string consisting of all characters from the source string with all upper case letters conve...
long GetInteger(const char *key, long dflt=0) const
Get the option value as an integer.
Definition: pstring.h:2901