Removed some redundant code from String::operator==()

This commit is contained in:
Tsuda Kageyu 2013-11-15 16:51:48 +09:00
parent 6dc1ce7fe7
commit 8a22c7ce75

View File

@ -155,11 +155,6 @@ public:
{
}
StringPrivate(const std::wstring &s)
: data(new std::wstring(s))
{
}
StringPrivate(size_t n, wchar_t c)
: data(new std::wstring(n, c))
{
@ -651,54 +646,43 @@ String &String::operator=(const String &s)
String &String::operator=(const std::string &s)
{
d->data.reset(new std::wstring());
copyFromLatin1(s.c_str(), s.length());
*this = String(s);
return *this;
}
String &String::operator=(const std::wstring &s)
{
d->data.reset(new std::wstring(s));
*this = String(s);
return *this;
}
String &String::operator=(const wchar_t *s)
{
d->data.reset(new std::wstring());
copyFromUTF16(s, ::wcslen(s), WCharByteOrder);
*this = String(s);
return *this;
}
String &String::operator=(char c)
{
d->data.reset(new std::wstring(1, c));
*this = String(c);
return *this;
}
String &String::operator=(wchar_t c)
{
d->data.reset(new std::wstring(1, c));
*this = String(c);
return *this;
}
String &String::operator=(const char *s)
{
d->data.reset(new std::wstring());
copyFromLatin1(s, ::strlen(s));
*this = String(s);
return *this;
}
String &String::operator=(const ByteVector &v)
{
d->data.reset(new std::wstring());
copyFromLatin1(v.data(), v.size());
// If we hit a null in the ByteVector, shrink the string again.
d->data->resize(::wcslen(d->data->c_str()));
*this = String(v);
return *this;
}