зеркало из https://github.com/mozilla/gecko-dev.git
Incremental changes. Modified the strategy for nested |nsPromiseConcatenation| objects. Changed the type of the fragment identifier in a fragment. These files are not part of the build.
This commit is contained in:
Родитель
f0398a8427
Коммит
7b543c486c
|
@ -93,7 +93,7 @@ class basic_nsAReadableString
|
||||||
const CharT* mEnd;
|
const CharT* mEnd;
|
||||||
|
|
||||||
const basic_nsAReadableString<CharT>* mOwningString;
|
const basic_nsAReadableString<CharT>* mOwningString;
|
||||||
void* mFragmentIdentifier;
|
PRUint32 mFragmentIdentifier;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
ConstFragment( const basic_nsAReadableString<CharT>* aOwner = 0 )
|
ConstFragment( const basic_nsAReadableString<CharT>* aOwner = 0 )
|
||||||
|
@ -384,8 +384,29 @@ class nsPromiseConcatenation
|
||||||
static const int kLeftString = 0;
|
static const int kLeftString = 0;
|
||||||
static const int kRightString = 1;
|
static const int kRightString = 1;
|
||||||
|
|
||||||
|
int
|
||||||
|
current_string( const ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
return (aFragment.mFragmentIdentifier & mFragmentIdentifierMask) ? kRightString : kLeftString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_left_string( ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
aFragment.mFragmentIdentifier &= ~mFragmentIdentifierMask;
|
||||||
|
return kLeftString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_right_string( ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
aFragment.mFragmentIdentifier |= mFragmentIdentifierMask;
|
||||||
|
return kRightString;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsPromiseConcatenation( const basic_nsAReadableString<CharT>& aLeftString, const basic_nsAReadableString<CharT>& aRightString )
|
nsPromiseConcatenation( const basic_nsAReadableString<CharT>& aLeftString, const basic_nsAReadableString<CharT>& aRightString, PRUint32 aMask = 1 )
|
||||||
|
: mFragmentIdentifierMask(aMask)
|
||||||
{
|
{
|
||||||
mStrings[kLeftString] = &aLeftString;
|
mStrings[kLeftString] = &aLeftString;
|
||||||
mStrings[kRightString] = &aRightString;
|
mStrings[kRightString] = &aRightString;
|
||||||
|
@ -393,9 +414,16 @@ class nsPromiseConcatenation
|
||||||
|
|
||||||
virtual PRUint32 Length() const;
|
virtual PRUint32 Length() const;
|
||||||
|
|
||||||
|
nsPromiseConcatenation<CharT> operator+( const basic_nsAReadableString<CharT>& rhs ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void operator+( const nsPromiseConcatenation<CharT>& ); // NOT TO BE IMPLEMENTED
|
||||||
|
// making this |private| stops you from over parenthesizing concatenation expressions, e.g., |(A+B) + (C+D)|
|
||||||
|
// which would break the algorithm for distributing bits in the fragment identifier
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const basic_nsAReadableString<CharT>* mStrings[2];
|
const basic_nsAReadableString<CharT>* mStrings[2];
|
||||||
mutable ConstFragment mFragment;
|
PRUint32 mFragmentIdentifierMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEF_STRING_COMPARISONS(nsPromiseConcatenation<CharT>)
|
NS_DEF_STRING_COMPARISONS(nsPromiseConcatenation<CharT>)
|
||||||
|
@ -420,27 +448,26 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
{
|
{
|
||||||
case kPrevFragment:
|
case kPrevFragment:
|
||||||
case kNextFragment:
|
case kNextFragment:
|
||||||
whichString = reinterpret_cast<PRInt32>(aFragment.mFragmentIdentifier);
|
whichString = current_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFirstFragment:
|
case kFirstFragment:
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kLeftString);
|
whichString = use_left_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kLastFragment:
|
case kLastFragment:
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kRightString);
|
whichString = use_right_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFragmentAt:
|
case kFragmentAt:
|
||||||
PRUint32 leftLength = mStrings[kLeftString]->Length();
|
PRUint32 leftLength = mStrings[kLeftString]->Length();
|
||||||
if ( aPosition < leftLength )
|
if ( aPosition < leftLength )
|
||||||
whichString = kLeftString;
|
whichString = use_left_string(aFragment);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
whichString = kRightString;
|
whichString = use_right_string(aFragment);
|
||||||
aPosition -= leftLength;
|
aPosition -= leftLength;
|
||||||
}
|
}
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -450,7 +477,7 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
result = mStrings[whichString]->GetFragment(mFragment, aRequest, aPosition);
|
result = mStrings[whichString]->GetFragment(aFragment, aRequest, aPosition);
|
||||||
|
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
|
@ -458,24 +485,28 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
if ( aRequest == kNextFragment && whichString == kLeftString )
|
if ( aRequest == kNextFragment && whichString == kLeftString )
|
||||||
{
|
{
|
||||||
aRequest = kFirstFragment;
|
aRequest = kFirstFragment;
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kRightString);
|
whichString = use_right_string(aFragment);
|
||||||
}
|
}
|
||||||
else if ( aRequest == kPrevFragment && whichString == kRightString )
|
else if ( aRequest == kPrevFragment && whichString == kRightString )
|
||||||
{
|
{
|
||||||
aRequest = kLastFragment;
|
aRequest = kLastFragment;
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kLeftString);
|
whichString = use_left_string(aFragment);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( !done );
|
while ( !done );
|
||||||
|
|
||||||
aFragment.mStart = mFragment.mStart;
|
|
||||||
aFragment.mEnd = mFragment.mEnd;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class CharT>
|
||||||
|
nsPromiseConcatenation<CharT>
|
||||||
|
nsPromiseConcatenation<CharT>::operator+( const basic_nsAReadableString<CharT>& rhs ) const
|
||||||
|
{
|
||||||
|
return nsPromiseConcatenation<CharT>(*this, rhs, mFragmentIdentifierMask<<1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class CharT>
|
template <class CharT>
|
||||||
class nsPromiseSubstring
|
class nsPromiseSubstring
|
||||||
|
@ -707,6 +738,9 @@ operator+( const basic_nsLiteralString<CharT>& lhs, const basic_nsLiteralString<
|
||||||
return nsPromiseConcatenation<CharT>(lhs, rhs);
|
return nsPromiseConcatenation<CharT>(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class CharT, class TraitsT>
|
template <class CharT, class TraitsT>
|
||||||
basic_ostream<CharT, class TraitsT>&
|
basic_ostream<CharT, class TraitsT>&
|
||||||
operator<<( basic_ostream<CharT, TraitsT>& os, const basic_nsAReadableString<CharT>& s )
|
operator<<( basic_ostream<CharT, TraitsT>& os, const basic_nsAReadableString<CharT>& s )
|
||||||
|
|
|
@ -55,7 +55,7 @@ class basic_nsAWritableString
|
||||||
CharT* mEnd;
|
CharT* mEnd;
|
||||||
|
|
||||||
basic_nsAWritableString<CharT>* mOwningString;
|
basic_nsAWritableString<CharT>* mOwningString;
|
||||||
void* mFragmentIdentifier;
|
PRUint32 mFragmentIdentifier;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
Fragment( basic_nsAWritableString<CharT>* aOwner = 0 )
|
Fragment( basic_nsAWritableString<CharT>* aOwner = 0 )
|
||||||
|
|
|
@ -93,7 +93,7 @@ class basic_nsAReadableString
|
||||||
const CharT* mEnd;
|
const CharT* mEnd;
|
||||||
|
|
||||||
const basic_nsAReadableString<CharT>* mOwningString;
|
const basic_nsAReadableString<CharT>* mOwningString;
|
||||||
void* mFragmentIdentifier;
|
PRUint32 mFragmentIdentifier;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
ConstFragment( const basic_nsAReadableString<CharT>* aOwner = 0 )
|
ConstFragment( const basic_nsAReadableString<CharT>* aOwner = 0 )
|
||||||
|
@ -384,8 +384,29 @@ class nsPromiseConcatenation
|
||||||
static const int kLeftString = 0;
|
static const int kLeftString = 0;
|
||||||
static const int kRightString = 1;
|
static const int kRightString = 1;
|
||||||
|
|
||||||
|
int
|
||||||
|
current_string( const ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
return (aFragment.mFragmentIdentifier & mFragmentIdentifierMask) ? kRightString : kLeftString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_left_string( ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
aFragment.mFragmentIdentifier &= ~mFragmentIdentifierMask;
|
||||||
|
return kLeftString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_right_string( ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
aFragment.mFragmentIdentifier |= mFragmentIdentifierMask;
|
||||||
|
return kRightString;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsPromiseConcatenation( const basic_nsAReadableString<CharT>& aLeftString, const basic_nsAReadableString<CharT>& aRightString )
|
nsPromiseConcatenation( const basic_nsAReadableString<CharT>& aLeftString, const basic_nsAReadableString<CharT>& aRightString, PRUint32 aMask = 1 )
|
||||||
|
: mFragmentIdentifierMask(aMask)
|
||||||
{
|
{
|
||||||
mStrings[kLeftString] = &aLeftString;
|
mStrings[kLeftString] = &aLeftString;
|
||||||
mStrings[kRightString] = &aRightString;
|
mStrings[kRightString] = &aRightString;
|
||||||
|
@ -393,9 +414,16 @@ class nsPromiseConcatenation
|
||||||
|
|
||||||
virtual PRUint32 Length() const;
|
virtual PRUint32 Length() const;
|
||||||
|
|
||||||
|
nsPromiseConcatenation<CharT> operator+( const basic_nsAReadableString<CharT>& rhs ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void operator+( const nsPromiseConcatenation<CharT>& ); // NOT TO BE IMPLEMENTED
|
||||||
|
// making this |private| stops you from over parenthesizing concatenation expressions, e.g., |(A+B) + (C+D)|
|
||||||
|
// which would break the algorithm for distributing bits in the fragment identifier
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const basic_nsAReadableString<CharT>* mStrings[2];
|
const basic_nsAReadableString<CharT>* mStrings[2];
|
||||||
mutable ConstFragment mFragment;
|
PRUint32 mFragmentIdentifierMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEF_STRING_COMPARISONS(nsPromiseConcatenation<CharT>)
|
NS_DEF_STRING_COMPARISONS(nsPromiseConcatenation<CharT>)
|
||||||
|
@ -420,27 +448,26 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
{
|
{
|
||||||
case kPrevFragment:
|
case kPrevFragment:
|
||||||
case kNextFragment:
|
case kNextFragment:
|
||||||
whichString = reinterpret_cast<PRInt32>(aFragment.mFragmentIdentifier);
|
whichString = current_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFirstFragment:
|
case kFirstFragment:
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kLeftString);
|
whichString = use_left_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kLastFragment:
|
case kLastFragment:
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kRightString);
|
whichString = use_right_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFragmentAt:
|
case kFragmentAt:
|
||||||
PRUint32 leftLength = mStrings[kLeftString]->Length();
|
PRUint32 leftLength = mStrings[kLeftString]->Length();
|
||||||
if ( aPosition < leftLength )
|
if ( aPosition < leftLength )
|
||||||
whichString = kLeftString;
|
whichString = use_left_string(aFragment);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
whichString = kRightString;
|
whichString = use_right_string(aFragment);
|
||||||
aPosition -= leftLength;
|
aPosition -= leftLength;
|
||||||
}
|
}
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -450,7 +477,7 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
result = mStrings[whichString]->GetFragment(mFragment, aRequest, aPosition);
|
result = mStrings[whichString]->GetFragment(aFragment, aRequest, aPosition);
|
||||||
|
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
|
@ -458,24 +485,28 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
if ( aRequest == kNextFragment && whichString == kLeftString )
|
if ( aRequest == kNextFragment && whichString == kLeftString )
|
||||||
{
|
{
|
||||||
aRequest = kFirstFragment;
|
aRequest = kFirstFragment;
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kRightString);
|
whichString = use_right_string(aFragment);
|
||||||
}
|
}
|
||||||
else if ( aRequest == kPrevFragment && whichString == kRightString )
|
else if ( aRequest == kPrevFragment && whichString == kRightString )
|
||||||
{
|
{
|
||||||
aRequest = kLastFragment;
|
aRequest = kLastFragment;
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kLeftString);
|
whichString = use_left_string(aFragment);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( !done );
|
while ( !done );
|
||||||
|
|
||||||
aFragment.mStart = mFragment.mStart;
|
|
||||||
aFragment.mEnd = mFragment.mEnd;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class CharT>
|
||||||
|
nsPromiseConcatenation<CharT>
|
||||||
|
nsPromiseConcatenation<CharT>::operator+( const basic_nsAReadableString<CharT>& rhs ) const
|
||||||
|
{
|
||||||
|
return nsPromiseConcatenation<CharT>(*this, rhs, mFragmentIdentifierMask<<1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class CharT>
|
template <class CharT>
|
||||||
class nsPromiseSubstring
|
class nsPromiseSubstring
|
||||||
|
@ -707,6 +738,9 @@ operator+( const basic_nsLiteralString<CharT>& lhs, const basic_nsLiteralString<
|
||||||
return nsPromiseConcatenation<CharT>(lhs, rhs);
|
return nsPromiseConcatenation<CharT>(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class CharT, class TraitsT>
|
template <class CharT, class TraitsT>
|
||||||
basic_ostream<CharT, class TraitsT>&
|
basic_ostream<CharT, class TraitsT>&
|
||||||
operator<<( basic_ostream<CharT, TraitsT>& os, const basic_nsAReadableString<CharT>& s )
|
operator<<( basic_ostream<CharT, TraitsT>& os, const basic_nsAReadableString<CharT>& s )
|
||||||
|
|
|
@ -55,7 +55,7 @@ class basic_nsAWritableString
|
||||||
CharT* mEnd;
|
CharT* mEnd;
|
||||||
|
|
||||||
basic_nsAWritableString<CharT>* mOwningString;
|
basic_nsAWritableString<CharT>* mOwningString;
|
||||||
void* mFragmentIdentifier;
|
PRUint32 mFragmentIdentifier;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
Fragment( basic_nsAWritableString<CharT>* aOwner = 0 )
|
Fragment( basic_nsAWritableString<CharT>* aOwner = 0 )
|
||||||
|
|
|
@ -93,7 +93,7 @@ class basic_nsAReadableString
|
||||||
const CharT* mEnd;
|
const CharT* mEnd;
|
||||||
|
|
||||||
const basic_nsAReadableString<CharT>* mOwningString;
|
const basic_nsAReadableString<CharT>* mOwningString;
|
||||||
void* mFragmentIdentifier;
|
PRUint32 mFragmentIdentifier;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
ConstFragment( const basic_nsAReadableString<CharT>* aOwner = 0 )
|
ConstFragment( const basic_nsAReadableString<CharT>* aOwner = 0 )
|
||||||
|
@ -384,8 +384,29 @@ class nsPromiseConcatenation
|
||||||
static const int kLeftString = 0;
|
static const int kLeftString = 0;
|
||||||
static const int kRightString = 1;
|
static const int kRightString = 1;
|
||||||
|
|
||||||
|
int
|
||||||
|
current_string( const ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
return (aFragment.mFragmentIdentifier & mFragmentIdentifierMask) ? kRightString : kLeftString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_left_string( ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
aFragment.mFragmentIdentifier &= ~mFragmentIdentifierMask;
|
||||||
|
return kLeftString;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
use_right_string( ConstFragment& aFragment ) const
|
||||||
|
{
|
||||||
|
aFragment.mFragmentIdentifier |= mFragmentIdentifierMask;
|
||||||
|
return kRightString;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsPromiseConcatenation( const basic_nsAReadableString<CharT>& aLeftString, const basic_nsAReadableString<CharT>& aRightString )
|
nsPromiseConcatenation( const basic_nsAReadableString<CharT>& aLeftString, const basic_nsAReadableString<CharT>& aRightString, PRUint32 aMask = 1 )
|
||||||
|
: mFragmentIdentifierMask(aMask)
|
||||||
{
|
{
|
||||||
mStrings[kLeftString] = &aLeftString;
|
mStrings[kLeftString] = &aLeftString;
|
||||||
mStrings[kRightString] = &aRightString;
|
mStrings[kRightString] = &aRightString;
|
||||||
|
@ -393,9 +414,16 @@ class nsPromiseConcatenation
|
||||||
|
|
||||||
virtual PRUint32 Length() const;
|
virtual PRUint32 Length() const;
|
||||||
|
|
||||||
|
nsPromiseConcatenation<CharT> operator+( const basic_nsAReadableString<CharT>& rhs ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void operator+( const nsPromiseConcatenation<CharT>& ); // NOT TO BE IMPLEMENTED
|
||||||
|
// making this |private| stops you from over parenthesizing concatenation expressions, e.g., |(A+B) + (C+D)|
|
||||||
|
// which would break the algorithm for distributing bits in the fragment identifier
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const basic_nsAReadableString<CharT>* mStrings[2];
|
const basic_nsAReadableString<CharT>* mStrings[2];
|
||||||
mutable ConstFragment mFragment;
|
PRUint32 mFragmentIdentifierMask;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEF_STRING_COMPARISONS(nsPromiseConcatenation<CharT>)
|
NS_DEF_STRING_COMPARISONS(nsPromiseConcatenation<CharT>)
|
||||||
|
@ -420,27 +448,26 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
{
|
{
|
||||||
case kPrevFragment:
|
case kPrevFragment:
|
||||||
case kNextFragment:
|
case kNextFragment:
|
||||||
whichString = reinterpret_cast<PRInt32>(aFragment.mFragmentIdentifier);
|
whichString = current_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFirstFragment:
|
case kFirstFragment:
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kLeftString);
|
whichString = use_left_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kLastFragment:
|
case kLastFragment:
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kRightString);
|
whichString = use_right_string(aFragment);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFragmentAt:
|
case kFragmentAt:
|
||||||
PRUint32 leftLength = mStrings[kLeftString]->Length();
|
PRUint32 leftLength = mStrings[kLeftString]->Length();
|
||||||
if ( aPosition < leftLength )
|
if ( aPosition < leftLength )
|
||||||
whichString = kLeftString;
|
whichString = use_left_string(aFragment);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
whichString = kRightString;
|
whichString = use_right_string(aFragment);
|
||||||
aPosition -= leftLength;
|
aPosition -= leftLength;
|
||||||
}
|
}
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -450,7 +477,7 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
result = mStrings[whichString]->GetFragment(mFragment, aRequest, aPosition);
|
result = mStrings[whichString]->GetFragment(aFragment, aRequest, aPosition);
|
||||||
|
|
||||||
if ( !result )
|
if ( !result )
|
||||||
{
|
{
|
||||||
|
@ -458,24 +485,28 @@ nsPromiseConcatenation<CharT>::GetFragment( ConstFragment& aFragment, FragmentRe
|
||||||
if ( aRequest == kNextFragment && whichString == kLeftString )
|
if ( aRequest == kNextFragment && whichString == kLeftString )
|
||||||
{
|
{
|
||||||
aRequest = kFirstFragment;
|
aRequest = kFirstFragment;
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kRightString);
|
whichString = use_right_string(aFragment);
|
||||||
}
|
}
|
||||||
else if ( aRequest == kPrevFragment && whichString == kRightString )
|
else if ( aRequest == kPrevFragment && whichString == kRightString )
|
||||||
{
|
{
|
||||||
aRequest = kLastFragment;
|
aRequest = kLastFragment;
|
||||||
aFragment.mFragmentIdentifier = reinterpret_cast<void*>(whichString = kLeftString);
|
whichString = use_left_string(aFragment);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while ( !done );
|
while ( !done );
|
||||||
|
|
||||||
aFragment.mStart = mFragment.mStart;
|
|
||||||
aFragment.mEnd = mFragment.mEnd;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class CharT>
|
||||||
|
nsPromiseConcatenation<CharT>
|
||||||
|
nsPromiseConcatenation<CharT>::operator+( const basic_nsAReadableString<CharT>& rhs ) const
|
||||||
|
{
|
||||||
|
return nsPromiseConcatenation<CharT>(*this, rhs, mFragmentIdentifierMask<<1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class CharT>
|
template <class CharT>
|
||||||
class nsPromiseSubstring
|
class nsPromiseSubstring
|
||||||
|
@ -707,6 +738,9 @@ operator+( const basic_nsLiteralString<CharT>& lhs, const basic_nsLiteralString<
|
||||||
return nsPromiseConcatenation<CharT>(lhs, rhs);
|
return nsPromiseConcatenation<CharT>(lhs, rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <class CharT, class TraitsT>
|
template <class CharT, class TraitsT>
|
||||||
basic_ostream<CharT, class TraitsT>&
|
basic_ostream<CharT, class TraitsT>&
|
||||||
operator<<( basic_ostream<CharT, TraitsT>& os, const basic_nsAReadableString<CharT>& s )
|
operator<<( basic_ostream<CharT, TraitsT>& os, const basic_nsAReadableString<CharT>& s )
|
||||||
|
|
|
@ -55,7 +55,7 @@ class basic_nsAWritableString
|
||||||
CharT* mEnd;
|
CharT* mEnd;
|
||||||
|
|
||||||
basic_nsAWritableString<CharT>* mOwningString;
|
basic_nsAWritableString<CharT>* mOwningString;
|
||||||
void* mFragmentIdentifier;
|
PRUint32 mFragmentIdentifier;
|
||||||
|
|
||||||
explicit
|
explicit
|
||||||
Fragment( basic_nsAWritableString<CharT>* aOwner = 0 )
|
Fragment( basic_nsAWritableString<CharT>* aOwner = 0 )
|
||||||
|
|
Загрузка…
Ссылка в новой задаче