зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384834 (part 3) - Remove nsAdopting[C]String. r=erahm.
--HG-- extra : rebase_source : a87c357fb0166620a33a40e1a01af32d5e7a907d
This commit is contained in:
Родитель
73558eac3d
Коммит
e5d1c73749
|
@ -4,33 +4,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
nsTAdoptingString_CharT&
|
||||
nsTAdoptingString_CharT::operator=(const self_type& str)
|
||||
{
|
||||
// This'll violate the constness of this argument, that's just
|
||||
// the nature of this class...
|
||||
self_type* mutable_str = const_cast<self_type*>(&str);
|
||||
|
||||
if (str.mDataFlags & DataFlags::OWNED) {
|
||||
// We want to do what Adopt() does, but without actually incrementing
|
||||
// the Adopt count. Note that we can be a little more straightforward
|
||||
// about this than Adopt() is, because we know that str.mData is
|
||||
// non-null. Should we be able to assert that str is not void here?
|
||||
NS_ASSERTION(str.mData, "String with null mData?");
|
||||
Finalize();
|
||||
SetData(str.mData, str.mLength, DataFlags::TERMINATED | DataFlags::OWNED);
|
||||
|
||||
// Make str forget the buffer we just took ownership of.
|
||||
new (mutable_str) self_type();
|
||||
} else {
|
||||
Assign(str);
|
||||
|
||||
mutable_str->Truncate();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void
|
||||
nsTString_CharT::Rebind(const char_type* data, size_type length)
|
||||
{
|
||||
|
|
|
@ -818,61 +818,3 @@ getter_Copies(nsTSubstring_CharT& aString)
|
|||
return nsTGetterCopies_CharT(aString);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* nsTAdoptingString extends nsTXPIDLString such that:
|
||||
*
|
||||
* (1) Adopt given string on construction or assignment, i.e. take
|
||||
* the value of what's given, and make what's given forget its
|
||||
* value. Note that this class violates constness in a few
|
||||
* places. Be careful!
|
||||
*/
|
||||
class nsTAdoptingString_CharT : public nsTXPIDLString_CharT
|
||||
{
|
||||
public:
|
||||
|
||||
typedef nsTAdoptingString_CharT self_type;
|
||||
|
||||
public:
|
||||
|
||||
explicit nsTAdoptingString_CharT()
|
||||
{
|
||||
}
|
||||
explicit nsTAdoptingString_CharT(char_type* aStr,
|
||||
size_type aLength = size_type(-1))
|
||||
{
|
||||
Adopt(aStr, aLength);
|
||||
}
|
||||
|
||||
// copy-constructor required to adopt on copy. Note that this
|
||||
// will violate the constness of |aStr| in the operator=()
|
||||
// call. |aStr| will be truncated as a side-effect of this
|
||||
// constructor.
|
||||
nsTAdoptingString_CharT(const self_type& aStr)
|
||||
: nsTXPIDLString_CharT()
|
||||
{
|
||||
*this = aStr;
|
||||
}
|
||||
|
||||
// |operator=| does not inherit, so we must define our own
|
||||
self_type& operator=(const substring_type& aStr)
|
||||
{
|
||||
Assign(aStr);
|
||||
return *this;
|
||||
}
|
||||
self_type& operator=(const substring_tuple_type& aTuple)
|
||||
{
|
||||
Assign(aTuple);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Adopt(), if possible, when assigning to a self_type&. Note
|
||||
// that this violates the constness of aStr, aStr is always
|
||||
// truncated when this operator is called.
|
||||
self_type& operator=(const self_type& aStr);
|
||||
|
||||
private:
|
||||
self_type& operator=(const char_type* aData) = delete;
|
||||
self_type& operator=(char_type* aData) = delete;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define nsTLiteralString_CharT nsLiteralCString
|
||||
#define nsTXPIDLString_CharT nsXPIDLCString
|
||||
#define nsTGetterCopies_CharT nsCGetterCopies
|
||||
#define nsTAdoptingString_CharT nsAdoptingCString
|
||||
#define nsTPromiseFlatString_CharT nsPromiseFlatCString
|
||||
#define TPromiseFlatString_CharT PromiseFlatCString
|
||||
#define nsTSubstringSplitter_CharT nsCSubstringSplitter
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#define nsTLiteralString_CharT nsLiteralString
|
||||
#define nsTXPIDLString_CharT nsXPIDLString
|
||||
#define nsTGetterCopies_CharT nsGetterCopies
|
||||
#define nsTAdoptingString_CharT nsAdoptingString
|
||||
#define nsTPromiseFlatString_CharT nsPromiseFlatString
|
||||
#define TPromiseFlatString_CharT PromiseFlatString
|
||||
#define nsTSubstringSplitter_CharT nsSubstringSplitter
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#undef nsTLiteralString_CharT
|
||||
#undef nsTXPIDLString_CharT
|
||||
#undef nsTGetterCopies_CharT
|
||||
#undef nsTAdoptingString_CharT
|
||||
#undef nsTPromiseFlatString_CharT
|
||||
#undef TPromiseFlatString_CharT
|
||||
#undef nsTSubstringSplitter_CharT
|
||||
|
|
Загрузка…
Ссылка в новой задаче