34 #ifndef PTLIB_STRING_H
35 #define PTLIB_STRING_H
149 const std::string & str
204 const wchar_t * ustr,
219 const PWCharArray & ustr
369 const std::string & str
1144 PINDEX count = P_MAX_INDEX,
1161 PINDEX count = P_MAX_INDEX,
1203 PINDEX offset = P_MAX_INDEX
1209 PINDEX offset = P_MAX_INDEX
1231 PINDEX offset = P_MAX_INDEX
1315 PINDEX maxPos = P_MAX_INDEX
1459 PINDEX len = P_MAX_INDEX
1556 const char * cseparators,
1746 PWCharArray AsUCS2()
const;
1789 operator const unsigned char *()
const;
1793 operator std::string ()
const
1825 virtual const char *
GetPointer(PINDEX = 0)
const {
return (
const char *)(*this); }
1832 void InternalFromUCS2(
1833 const wchar_t * ptr,
1868 string.PrintOn(stream);
1872 #ifdef P_HAS_WOSTREAM
1875 return stream << (
const char *)
string;
1881 class PWideString :
public PWCharArray {
1885 typedef const wchar_t * Initialiser;
1888 PWideString(
const PWCharArray & arr) : PWCharArray(arr) { }
1889 PWideString(
const PString & str) : PWCharArray(str.AsUCS2()) { }
1890 PWideString(
const char * str) : PWCharArray(
PString(str).AsUCS2()) { }
1891 PWideString & operator=(
const PWideString & str) { PWCharArray::operator=(str);
return *
this; }
1892 PWideString & operator=(
const PString & str) { PWCharArray::operator=(str.AsUCS2());
return *
this; }
1893 PWideString & operator=(
const std::string & str) { PWCharArray::operator=(
PString(str.c_str()).AsUCS2());
return *
this; }
1894 PWideString & operator=(
const char * str) { PWCharArray::operator=(
PString(str).AsUCS2());
return *
this; }
1895 friend inline ostream &
operator<<(ostream & stream,
const PWideString &
string) {
return stream <<
PString(
string); }
1902 typedef PWideString PVarString;
1948 const std::string & str
1971 const std::string & str
2045 template <
class ParentString>
2052 : ParentString(m_staticReference, init != NULL ? strlen(init) : 0)
2055 this->theArray = (
char *)(init != NULL ? init :
"");
2065 : ParentString(m_staticReference)
2066 , m_staticReference(0, true)
2105 PINDEX fixedBufferSize
2202 class Buffer :
public streambuf {
2205 Buffer(
const Buffer & sbuf);
2206 Buffer &
operator=(
const Buffer & sbuf);
2207 virtual int_type overflow(int_type = EOF);
2208 virtual int_type underflow();
2210 virtual pos_type seekoff(off_type, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
2211 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
2229 #define PSTRSTRM(arg) dynamic_cast<const PString &>(PStringStream() << std::flush << arg)
2269 char const *
const * strarr,
2292 const std::vector<PString> & vec
2295 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
2303 const std::vector<std::string> & vec
2306 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
2313 template <
typename stlContainer>
2315 const stlContainer & vec
2319 for (
typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
2442 char const *
const * strarr,
2523 template <
typename stlContainer>
2525 const stlContainer & vec
2529 for (
typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
2548 #ifdef DOC_PLUS_PLUS
2559 char const *
const * strarr,
2664 char const *
const * strarr,
2778 return str != NULL ? *str :
PString(dflt);
2818 #define PDECLARE_STRING_DICTIONARY(cls, K) \
2819 PDECLARE_CLASS(cls, PStringDictionary<K>) \
2821 cls(int dummy, const cls * c) \
2822 : PStringDictionary<K>(dummy, c) { } \
2825 : PStringDictionary<K>() { } \
2826 virtual PObject * Clone() const \
2827 { return PNEW cls(0, this); } \
2842 #define PSTRING_DICTIONARY(cls, K) typedef PStringDictionary<K> cls
2859 #ifdef DOC_PLUS_PLUS
2906 #ifdef DOC_PLUS_PLUS
2957 #ifdef DOC_PLUS_PLUS
3078 bool GetBoolean(
const char * key,
bool dflt =
false)
const { PConstCaselessString k(key);
return GetBoolean(k, dflt); }
3090 long GetInteger(
const char * key,
long dflt = 0)
const { PConstCaselessString k(key);
return GetInteger(k, dflt); }
3102 template<
typename E> E
GetEnum(
const char * key, E dflt)
const { PConstCaselessString k(key);
return GetEnum(k, dflt); }
3108 template<
typename E>
void SetEnum(
const char * key, E value) { PConstCaselessString k(key);
SetInteger(k, value); }
3114 double GetReal(
const char * key,
double dflt = 0)
const { PConstCaselessString k(key);
return GetReal(k, dflt); }
3120 void SetReal(
const char * key,
double value,
int decimals) { PConstCaselessString k(key);
SetReal(k, value, decimals); }
3205 CompileOptions options = IgnoreCase
3211 const char * cpattern,
3212 CompileOptions options = IgnoreCase
3313 CompileOptions options = IgnoreCase
3323 const char * cpattern,
3324 CompileOptions options = IgnoreCase
3332 ExecOptions options = Normal
3339 ExecOptions options = Normal
3345 ExecOptions options = Normal
3352 ExecOptions options = Normal
3358 ExecOptions options = Normal
3365 ExecOptions options = Normal
3371 ExecOptions options = Normal
3393 ExecOptions options = Normal
3414 ExecOptions options = Normal
3442 #endif // PTLIB_STRING_H