mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
Bug 265534. Take some string constructors out of line to reduce codesize. r=bsmedberg, sr=dbaron
This commit is contained in:
parent
964c1575aa
commit
878d2da364
@ -448,20 +448,9 @@ class nsTFixedString_CharT : public nsTString_CharT
|
||||
* the length of the string already contained in the buffer
|
||||
*/
|
||||
|
||||
nsTFixedString_CharT( char_type* data, size_type storageSize )
|
||||
: string_type(data, PRUint32(char_traits::length(data)), F_TERMINATED | F_FIXED | F_CLASS_FIXED)
|
||||
, mFixedCapacity(storageSize - 1)
|
||||
, mFixedBuf(data)
|
||||
{}
|
||||
NS_COM nsTFixedString_CharT( char_type* data, size_type storageSize );
|
||||
|
||||
nsTFixedString_CharT( char_type* data, size_type storageSize, size_type length )
|
||||
: string_type(data, length, F_TERMINATED | F_FIXED | F_CLASS_FIXED)
|
||||
, mFixedCapacity(storageSize - 1)
|
||||
, mFixedBuf(data)
|
||||
{
|
||||
// null-terminate
|
||||
mFixedBuf[length] = char_type(0);
|
||||
}
|
||||
NS_COM nsTFixedString_CharT( char_type* data, size_type storageSize, size_type length );
|
||||
|
||||
// |operator=| does not inherit, so we must define our own
|
||||
self_type& operator=( char_type c ) { Assign(c); return *this; }
|
||||
|
@ -480,17 +480,7 @@ class nsTSubstring_CharT : public nsTAString_CharT
|
||||
* this is public to support automatic conversion of tuple to string
|
||||
* base type, which helps avoid converting to nsTAString.
|
||||
*/
|
||||
nsTSubstring_CharT(const substring_tuple_type& tuple)
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(nsnull, 0, F_NONE)
|
||||
#else
|
||||
: mData(nsnull),
|
||||
mLength(0),
|
||||
mFlags(F_NONE)
|
||||
#endif
|
||||
{
|
||||
Assign(tuple);
|
||||
}
|
||||
NS_COM nsTSubstring_CharT(const substring_tuple_type& tuple);
|
||||
|
||||
/**
|
||||
* allows for direct initialization of a nsTSubstring object.
|
||||
@ -519,35 +509,15 @@ class nsTSubstring_CharT : public nsTAString_CharT
|
||||
#endif
|
||||
|
||||
// default initialization
|
||||
nsTSubstring_CharT()
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(
|
||||
const_cast<char_type*>(char_traits::sEmptyBuffer), 0, F_TERMINATED) {}
|
||||
#else
|
||||
: mData(const_cast<char_type*>(char_traits::sEmptyBuffer)),
|
||||
mLength(0),
|
||||
mFlags(F_TERMINATED) {}
|
||||
#endif
|
||||
NS_COM nsTSubstring_CharT();
|
||||
|
||||
// version of constructor that leaves mData and mLength uninitialized
|
||||
explicit
|
||||
nsTSubstring_CharT( PRUint32 flags )
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(flags) {}
|
||||
#else
|
||||
: mFlags(flags) {}
|
||||
#endif
|
||||
NS_COM nsTSubstring_CharT( PRUint32 flags );
|
||||
|
||||
// copy-constructor, constructs as dependent on given object
|
||||
// (NOTE: this is for internal use only)
|
||||
nsTSubstring_CharT( const self_type& str )
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(str.mData, str.mLength, str.mFlags & (F_TERMINATED | F_VOIDED)) {}
|
||||
#else
|
||||
: mData(str.mData),
|
||||
mLength(str.mLength),
|
||||
mFlags(str.mFlags & (F_TERMINATED | F_VOIDED)) {}
|
||||
#endif
|
||||
NS_COM nsTSubstring_CharT( const self_type& str );
|
||||
|
||||
/**
|
||||
* this function releases mData and does not change the value of
|
||||
|
@ -69,3 +69,17 @@ nsTAdoptingString_CharT::operator=( const self_type& str )
|
||||
return *this;
|
||||
}
|
||||
|
||||
nsTFixedString_CharT::nsTFixedString_CharT( char_type* data, size_type storageSize )
|
||||
: string_type(data, PRUint32(char_traits::length(data)), F_TERMINATED | F_FIXED | F_CLASS_FIXED)
|
||||
, mFixedCapacity(storageSize - 1)
|
||||
, mFixedBuf(data)
|
||||
{}
|
||||
|
||||
nsTFixedString_CharT::nsTFixedString_CharT( char_type* data, size_type storageSize, size_type length )
|
||||
: string_type(data, length, F_TERMINATED | F_FIXED | F_CLASS_FIXED)
|
||||
, mFixedCapacity(storageSize - 1)
|
||||
, mFixedBuf(data)
|
||||
{
|
||||
// null-terminate
|
||||
mFixedBuf[length] = char_type(0);
|
||||
}
|
||||
|
@ -54,6 +54,44 @@ nsTSubstring_CharT::nsTSubstring_CharT( char_type *data, size_type length,
|
||||
}
|
||||
}
|
||||
|
||||
nsTSubstring_CharT::nsTSubstring_CharT(const substring_tuple_type& tuple)
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(nsnull, 0, F_NONE)
|
||||
#else
|
||||
: mData(nsnull),
|
||||
mLength(0),
|
||||
mFlags(F_NONE)
|
||||
#endif
|
||||
{
|
||||
Assign(tuple);
|
||||
}
|
||||
|
||||
nsTSubstring_CharT::nsTSubstring_CharT()
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(
|
||||
const_cast<char_type*>(char_traits::sEmptyBuffer), 0, F_TERMINATED) {}
|
||||
#else
|
||||
: mData(const_cast<char_type*>(char_traits::sEmptyBuffer)),
|
||||
mLength(0),
|
||||
mFlags(F_TERMINATED) {}
|
||||
#endif
|
||||
|
||||
nsTSubstring_CharT::nsTSubstring_CharT( PRUint32 flags )
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(flags) {}
|
||||
#else
|
||||
: mFlags(flags) {}
|
||||
#endif
|
||||
|
||||
nsTSubstring_CharT::nsTSubstring_CharT( const self_type& str )
|
||||
#ifdef MOZ_V1_STRING_ABI
|
||||
: abstract_string_type(str.mData, str.mLength, str.mFlags & (F_TERMINATED | F_VOIDED)) {}
|
||||
#else
|
||||
: mData(str.mData),
|
||||
mLength(str.mLength),
|
||||
mFlags(str.mFlags & (F_TERMINATED | F_VOIDED)) {}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* helper function for down-casting a nsTSubstring to a nsTFixedString.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user