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