Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/lobby/glooxwrapper/glooxwrapper.h
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | string& operator=(const string& str) | ||||
return *this; | return *this; | ||||
} | } | ||||
~string() | ~string() | ||||
{ | { | ||||
glooxwrapper_free(m_Data); | glooxwrapper_free(m_Data); | ||||
} | } | ||||
/** | |||||
* Gloox strings are UTF encoded, so don't forget to decode it before passing it to the GUI! | |||||
*/ | |||||
std::string to_string() const | std::string to_string() const | ||||
{ | { | ||||
return std::string(m_Data, m_Size); | return std::string(m_Data, m_Size); | ||||
} | } | ||||
const char* c_str() const | const char* c_str() const | ||||
{ | { | ||||
return m_Data; | return m_Data; | ||||
} | } | ||||
bool empty() const | bool empty() const | ||||
{ | { | ||||
return m_Size == 0; | return m_Size == 0; | ||||
} | } | ||||
bool operator==(const char* str) const | bool operator==(const char* str) const | ||||
{ | { | ||||
return strcmp(m_Data, str) == 0; | return strcmp(m_Data, str) == 0; | ||||
} | } | ||||
bool operator!=(const char* str) const | bool operator!=(const char* str) const | ||||
{ | { | ||||
return strcmp(m_Data, str) != 0; | return strcmp(m_Data, str) != 0; | ||||
} | } | ||||
bool operator==(const string& str) const | |||||
{ | |||||
return strcmp(m_Data, str.m_Data) == 0; | |||||
} | |||||
bool operator<(const string& str) const | |||||
{ | |||||
return strcmp(m_Data, str.m_Data) < 0; | |||||
} | |||||
}; | }; | ||||
static inline std::ostream& operator<<(std::ostream& stream, const string& string) | static inline std::ostream& operator<<(std::ostream& stream, const string& string) | ||||
{ | { | ||||
return stream << string.c_str(); | return stream << string.c_str(); | ||||
} | } | ||||
template<typename T> | template<typename T> | ||||
▲ Show 20 Lines • Show All 483 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator