34 #ifndef PTLIB_STRING_H
35 #define PTLIB_STRING_H
149 const std::string & str
204 const wchar_t * ustr,
219 const PWCharArray & ustr
283 #ifdef HAVE_LONG_LONG_INT
293 #ifdef HAVE_UNSIGNED_LONG_LONG_INT
328 #ifdef HAVE_LONG_LONG_INT
338 #ifdef HAVE_UNSIGNED_LONG_LONG_INT
379 const std::string & str
455 #ifdef HAVE_LONG_LONG_INT
465 #ifdef HAVE_UNSIGNED_LONG_LONG_INT
1158 PINDEX count = P_MAX_INDEX,
1175 PINDEX count = P_MAX_INDEX,
1217 PINDEX offset = P_MAX_INDEX
1223 PINDEX offset = P_MAX_INDEX
1245 PINDEX offset = P_MAX_INDEX
1329 PINDEX maxPos = P_MAX_INDEX
1473 PINDEX len = P_MAX_INDEX
1570 const char * cseparators,
1684 template <
typename T> __inline T
As(T t = T())
const;
1765 PWCharArray AsUCS2()
const;
1808 operator const unsigned char *()
const;
1812 operator std::string ()
const
1844 virtual const char *
GetPointer(PINDEX = 0)
const {
return (
const char *)(*this); }
1851 void InternalFromUCS2(
1852 const wchar_t * ptr,
1887 string.PrintOn(stream);
1891 #ifdef P_HAS_WOSTREAM
1894 return stream << (
const char *)
string;
1900 class PWideString :
public PWCharArray {
1904 typedef const wchar_t * Initialiser;
1907 PWideString(
const PWCharArray & arr) : PWCharArray(arr) { }
1908 PWideString(
const PString & str) : PWCharArray(str.AsUCS2()) { }
1909 PWideString(
const char * str);
1910 PWideString & operator=(
const PWideString & str) { PWCharArray::operator=(str);
return *
this; }
1911 PWideString & operator=(
const PString & str) { PWCharArray::operator=(str.AsUCS2());
return *
this; }
1912 PWideString & operator=(
const std::string & str);
1913 PWideString & operator=(
const char * str);
1914 friend inline ostream &
operator<<(ostream & stream,
const PWideString &
string) {
return stream <<
PString(
string); }
1916 PINDEX GetLength()
const {
return GetSize() - 1; }
1923 typedef PWideString PVarString;
1969 const std::string & str
1992 const std::string & str
2066 template <
class ParentString>
2073 : ParentString(m_staticReference, init != NULL ? strlen(init) : 0)
2076 this->theArray = (
char *)(init != NULL ? init :
"");
2080 : ParentString(m_staticReference, other.m_length)
2081 , m_staticReference(other.m_length + 1, true)
2083 this->theArray = other.theArray;
2109 __inline PWideString::PWideString(
const char * str) : PWCharArray(PConstString(str).AsUCS2()) { }
2110 __inline PWideString & PWideString::operator=(
const std::string & str) { PWCharArray::operator=(
PConstString(str.c_str()).AsUCS2());
return *
this; }
2111 __inline PWideString & PWideString::operator=(
const char * str) { PWCharArray::operator=(
PConstString(str).AsUCS2());
return *
this; }
2140 PINDEX fixedBufferSize
2236 : std::iostream(cout.rdbuf())
2240 class Buffer :
public streambuf {
2243 Buffer(
const Buffer & sbuf);
2244 Buffer &
operator=(
const Buffer & sbuf);
2245 virtual int_type overflow(int_type = EOF);
2246 virtual int_type underflow();
2248 virtual pos_type seekoff(std::streamoff, ios_base::seekdir, ios_base::openmode = ios_base::in | ios_base::out);
2249 virtual pos_type seekpos(pos_type, ios_base::openmode = ios_base::in | ios_base::out);
2267 #define PSTRSTRM(arg) dynamic_cast<const PString &>(PStringStream() << std::flush << arg)
2322 char const *
const * strarr,
2355 const std::vector<PString> & vec
2358 for (std::vector<PString>::const_iterator r = vec.begin(); r != vec.end(); ++r)
2366 const std::vector<std::string> & vec
2369 for (std::vector<std::string>::const_iterator r = vec.begin(); r != vec.end(); ++r)
2376 template <
typename stlContainer>
2378 const stlContainer & vec
2382 for (
typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
2474 char separator =
' '
2516 char const *
const * strarr,
2608 template <
typename stlContainer>
2610 const stlContainer & vec
2614 for (
typename stlContainer::const_iterator r = vec.begin(); r != vec.end(); ++r)
2657 char const *
const * strarr,
2775 char const *
const * strarr,
2894 return str != NULL ? *str :
PString(dflt);
2934 #define PDECLARE_STRING_DICTIONARY(cls, K) \
2935 PDECLARE_CLASS(cls, PStringDictionary<K>) \
2937 cls(int dummy, const cls * c) \
2938 : PStringDictionary<K>(dummy, c) { } \
2941 : PStringDictionary<K>() { } \
2942 virtual PObject * Clone() const \
2943 { return PNEW cls(0, this); } \
2958 #define PSTRING_DICTIONARY(cls, K) typedef PStringDictionary<K> cls
2975 #ifdef DOC_PLUS_PLUS
3022 #ifdef DOC_PLUS_PLUS
3080 #ifdef DOC_PLUS_PLUS
3201 bool GetBoolean(
const char * key,
bool dflt =
false)
const { PConstCaselessString k(key);
return GetBoolean(k, dflt); }
3213 long GetInteger(
const char * key,
long dflt = 0)
const { PConstCaselessString k(key);
return GetInteger(k, dflt); }
3225 template<
typename E> E
GetEnum(
const char * key, E dflt)
const { PConstCaselessString k(key);
return GetEnum(k, dflt); }
3231 template<
typename E>
void SetEnum(
const char * key, E value) { PConstCaselessString k(key);
SetInteger(k, value); }
3237 double GetReal(
const char * key,
double dflt = 0)
const { PConstCaselessString k(key);
return GetReal(k, dflt); }
3243 void SetReal(
const char * key,
double value,
int decimals) { PConstCaselessString k(key);
SetReal(k, value, decimals); }
3328 CompileOptions options = IgnoreCase
3334 const char * cpattern,
3335 CompileOptions options = IgnoreCase
3436 CompileOptions options = IgnoreCase
3446 const char * cpattern,
3447 CompileOptions options = IgnoreCase
3455 ExecOptions options = Normal
3462 ExecOptions options = Normal
3468 ExecOptions options = Normal
3475 ExecOptions options = Normal
3481 ExecOptions options = Normal
3488 ExecOptions options = Normal
3494 ExecOptions options = Normal
3516 ExecOptions options = Normal
3537 ExecOptions options = Normal
3565 #endif // PTLIB_STRING_H