00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef PTLIB_WXSTRING_H
00032 #define PTLIB_WXSTRING_H
00033
00034 #ifdef P_USE_PRAGMA
00035 #pragma interface
00036 #endif
00037
00040 class PwxString : public wxString
00041 {
00042 public:
00043 PwxString() { }
00044 PwxString(const wxString & str) : wxString(str) { }
00045 PwxString(const PString & str) : wxString(str, wxConvUTF8 ) { }
00046 PwxString(const PFilePath & fn) : wxString(fn, wxConvUTF8 ) { }
00047 PwxString(const char * str) : wxString(str, wxConvUTF8) { }
00048 PwxString(const OpalMediaFormat & fmt) : wxString(fmt, wxConvUTF8) { }
00049 #if wxUSE_UNICODE
00050 PwxString(const wchar_t * wstr) : wxString(wstr) { }
00051 #endif
00052
00053 inline PwxString & operator=(const char * str) { *this = wxString::wxString(str, wxConvUTF8); return *this; }
00054 #if wxUSE_UNICODE
00055 inline PwxString & operator=(const wchar_t * wstr) { wxString::operator=(wstr); return *this; }
00056 #endif
00057 inline PwxString & operator=(const wxString & str) { wxString::operator=(str); return *this; }
00058 inline PwxString & operator=(const PString & str) { *this = wxString::wxString(str, wxConvUTF8); return *this; }
00059
00060 inline bool operator==(const char * other) const { return IsSameAs(wxString(other, wxConvUTF8)); }
00061 #if wxUSE_UNICODE
00062 inline bool operator==(const wchar_t * other) const { return IsSameAs(other); }
00063 #endif
00064 inline bool operator==(const wxString & other) const { return IsSameAs(other); }
00065 inline bool operator==(const PString & other) const { return IsSameAs(wxString(other, wxConvUTF8)); }
00066 inline bool operator==(const PwxString & other) const { return IsSameAs(other); }
00067 inline bool operator==(const OpalMediaFormat & other) const { return IsSameAs(wxString(other, wxConvUTF8)); }
00068
00069 inline bool operator!=(const char * other) const { return !IsSameAs(wxString(other, wxConvUTF8)); }
00070 #if wxUSE_UNICODE
00071 inline bool operator!=(const wchar_t * other) const { return !IsSameAs(other); }
00072 #endif
00073 inline bool operator!=(const wxString & other) const { return !IsSameAs(other); }
00074 inline bool operator!=(const PString & other) const { return !IsSameAs(wxString(other, wxConvUTF8)); }
00075 inline bool operator!=(const PwxString & other) const { return !IsSameAs(other); }
00076 inline bool operator!=(const OpalMediaFormat & other) const { return !IsSameAs(wxString(other, wxConvUTF8)); }
00077
00078 #if wxUSE_UNICODE
00079 inline PString p_str() const { return ToUTF8().data(); }
00080 inline operator PString() const { return ToUTF8().data(); }
00081 inline operator PFilePath() const { return ToUTF8().data(); }
00082 inline operator PIPSocket::Address() const { return PString(ToUTF8().data()); }
00083 inline friend ostream & operator<<(ostream & stream, const PwxString & string) { return stream << string.ToUTF8(); }
00084 inline friend wostream & operator<<(wostream & stream, const PwxString & string) { return stream << string.c_str(); }
00085 #else
00086 inline PString p_str() const { return c_str(); }
00087 inline operator PString() const { return c_str(); }
00088 inline operator PFilePath() const { return c_str(); }
00089 inline operator PIPSocket::Address() const { return c_str(); }
00090 inline friend ostream & operator<<(ostream & stream, const PwxString & string) { return stream << string.c_str(); }
00091 inline friend wostream & operator<<(wostream & stream, const PwxString & string) { return stream << string.c_str(); }
00092 #endif
00093 };
00094
00095
00096 #endif // PTLIB_WXSTRING_H
00097
00098
00099