add operator==

This commit is contained in:
Dana Jansens 2003-02-04 23:33:07 +00:00
parent b8735c759a
commit 5833652604
2 changed files with 21 additions and 0 deletions

View file

@ -229,6 +229,21 @@ ustring::value_type ustring::operator[](ustring::size_type i) const
return utf8_get_char(utf8_offset_to_ptr(_string.data(), i));
}
bool ustring::operator==(const ustring &other) const
{
return _string == other._string && _utf8 == other._utf8;
}
bool ustring::operator==(const std::string &other) const
{
return _string == other;
}
bool ustring::operator==(const char *other) const
{
return _string == other;
}
const char* ustring::data() const
{
return _string.data();

View file

@ -155,6 +155,12 @@ public:
// No reference return; use replace() to write characters.
value_type operator[](size_type i) const;
// compare strings
bool operator==(const ustring &other) const;
bool operator==(const std::string &other) const;
bool operator==(const char *other) const;
// internal data
const char* data() const;