incremental changes. these files are not yet part of the build

This commit is contained in:
scc%netscape.com 2000-03-31 07:28:38 +00:00
Родитель f563b72b38
Коммит 74a3c00cac
6 изменённых файлов: 90 добавлений и 74 удалений

Просмотреть файл

@ -268,11 +268,15 @@ class basic_nsAReadableString
int Compare( const basic_nsAReadableString<CharT>& rhs ) const;
// int Compare( const basic_nsLiteralString<CharT>& rhs ) const;
int Compare( const CharT* ) const;
int Compare( const CharT*, PRUint32 ) const;
// int Compare( CharT ) const;
// |Equals()| is a synonym for |Compare()|
PRBool Equals( const basic_nsAReadableString<CharT>& rhs ) const;
// PRBool Equals( const basic_nsLiteralString<CharT>& rhs ) const;
PRBool Equals( const CharT* ) const;
PRBool Equals( const CharT*, PRUint32 ) const;
// PRBool Equals( CharT ) const;
// Comparison operators are all synonyms for |Compare()|
PRBool operator!=( const basic_nsAReadableString<CharT>& rhs ) const { return Compare(rhs)!=0; }
@ -382,15 +386,21 @@ basic_nsAReadableString<CharT>::Equals( const basic_nsAReadableString<CharT>& rh
return Compare(rhs) == 0;
}
#if 0
template <class CharT>
inline
PRBool
basic_nsAReadableString<CharT>::Equals( const basic_nsLiteralString<CharT>& rhs ) const
basic_nsAReadableString<CharT>::Equals( const CharT* rhs ) const
{
return Compare(rhs) == 0;
return Compare(basic_nsLiteralString<CharT>(rhs)) == 0;
}
template <class CharT>
inline
PRBool
basic_nsAReadableString<CharT>::Equals( const CharT* rhs, PRUint32 rhs_length ) const
{
return Compare(basic_nsLiteralString<CharT>(rhs, rhs_length)) == 0;
}
#endif
template <class CharT>
inline
@ -563,15 +573,21 @@ basic_nsAReadableString<CharT>::Compare( const basic_nsAReadableString<CharT>& r
return ::Compare(*this, rhs);
}
#if 0
template <class CharT>
inline
int
basic_nsAReadableString<CharT>::Compare( const basic_nsLiteralString<CharT>& rhs ) const
basic_nsAReadableString<CharT>::Compare( const CharT* rhs ) const
{
return ::Compare(*this, rhs);
return ::Compare(*this, basic_nsLiteralString<CharT>(rhs));
}
template <class CharT>
inline
int
basic_nsAReadableString<CharT>::Compare( const CharT* rhs, PRUint32 rhs_length ) const
{
return ::Compare(*this, basic_nsLiteralString<CharT>(rhs, rhs_length));
}
#endif

Просмотреть файл

@ -268,11 +268,15 @@ class basic_nsAReadableString
int Compare( const basic_nsAReadableString<CharT>& rhs ) const;
// int Compare( const basic_nsLiteralString<CharT>& rhs ) const;
int Compare( const CharT* ) const;
int Compare( const CharT*, PRUint32 ) const;
// int Compare( CharT ) const;
// |Equals()| is a synonym for |Compare()|
PRBool Equals( const basic_nsAReadableString<CharT>& rhs ) const;
// PRBool Equals( const basic_nsLiteralString<CharT>& rhs ) const;
PRBool Equals( const CharT* ) const;
PRBool Equals( const CharT*, PRUint32 ) const;
// PRBool Equals( CharT ) const;
// Comparison operators are all synonyms for |Compare()|
PRBool operator!=( const basic_nsAReadableString<CharT>& rhs ) const { return Compare(rhs)!=0; }
@ -382,15 +386,21 @@ basic_nsAReadableString<CharT>::Equals( const basic_nsAReadableString<CharT>& rh
return Compare(rhs) == 0;
}
#if 0
template <class CharT>
inline
PRBool
basic_nsAReadableString<CharT>::Equals( const basic_nsLiteralString<CharT>& rhs ) const
basic_nsAReadableString<CharT>::Equals( const CharT* rhs ) const
{
return Compare(rhs) == 0;
return Compare(basic_nsLiteralString<CharT>(rhs)) == 0;
}
template <class CharT>
inline
PRBool
basic_nsAReadableString<CharT>::Equals( const CharT* rhs, PRUint32 rhs_length ) const
{
return Compare(basic_nsLiteralString<CharT>(rhs, rhs_length)) == 0;
}
#endif
template <class CharT>
inline
@ -563,15 +573,21 @@ basic_nsAReadableString<CharT>::Compare( const basic_nsAReadableString<CharT>& r
return ::Compare(*this, rhs);
}
#if 0
template <class CharT>
inline
int
basic_nsAReadableString<CharT>::Compare( const basic_nsLiteralString<CharT>& rhs ) const
basic_nsAReadableString<CharT>::Compare( const CharT* rhs ) const
{
return ::Compare(*this, rhs);
return ::Compare(*this, basic_nsLiteralString<CharT>(rhs));
}
template <class CharT>
inline
int
basic_nsAReadableString<CharT>::Compare( const CharT* rhs, PRUint32 rhs_length ) const
{
return ::Compare(*this, basic_nsLiteralString<CharT>(rhs, rhs_length));
}
#endif

Просмотреть файл

@ -268,11 +268,15 @@ class basic_nsAReadableString
int Compare( const basic_nsAReadableString<CharT>& rhs ) const;
// int Compare( const basic_nsLiteralString<CharT>& rhs ) const;
int Compare( const CharT* ) const;
int Compare( const CharT*, PRUint32 ) const;
// int Compare( CharT ) const;
// |Equals()| is a synonym for |Compare()|
PRBool Equals( const basic_nsAReadableString<CharT>& rhs ) const;
// PRBool Equals( const basic_nsLiteralString<CharT>& rhs ) const;
PRBool Equals( const CharT* ) const;
PRBool Equals( const CharT*, PRUint32 ) const;
// PRBool Equals( CharT ) const;
// Comparison operators are all synonyms for |Compare()|
PRBool operator!=( const basic_nsAReadableString<CharT>& rhs ) const { return Compare(rhs)!=0; }
@ -382,15 +386,21 @@ basic_nsAReadableString<CharT>::Equals( const basic_nsAReadableString<CharT>& rh
return Compare(rhs) == 0;
}
#if 0
template <class CharT>
inline
PRBool
basic_nsAReadableString<CharT>::Equals( const basic_nsLiteralString<CharT>& rhs ) const
basic_nsAReadableString<CharT>::Equals( const CharT* rhs ) const
{
return Compare(rhs) == 0;
return Compare(basic_nsLiteralString<CharT>(rhs)) == 0;
}
template <class CharT>
inline
PRBool
basic_nsAReadableString<CharT>::Equals( const CharT* rhs, PRUint32 rhs_length ) const
{
return Compare(basic_nsLiteralString<CharT>(rhs, rhs_length)) == 0;
}
#endif
template <class CharT>
inline
@ -563,15 +573,21 @@ basic_nsAReadableString<CharT>::Compare( const basic_nsAReadableString<CharT>& r
return ::Compare(*this, rhs);
}
#if 0
template <class CharT>
inline
int
basic_nsAReadableString<CharT>::Compare( const basic_nsLiteralString<CharT>& rhs ) const
basic_nsAReadableString<CharT>::Compare( const CharT* rhs ) const
{
return ::Compare(*this, rhs);
return ::Compare(*this, basic_nsLiteralString<CharT>(rhs));
}
template <class CharT>
inline
int
basic_nsAReadableString<CharT>::Compare( const CharT* rhs, PRUint32 rhs_length ) const
{
return ::Compare(*this, basic_nsLiteralString<CharT>(rhs, rhs_length));
}
#endif

Просмотреть файл

@ -136,11 +136,8 @@ class basic_nsStdStringWrapper
mRawString.resize(aNewLength);
}
virtual void Assign( const basic_nsAReadableString<CharT>& );
virtual void Append( const basic_nsAReadableString<CharT>& );
virtual void AppendChar( CharT );
virtual void Insert( const basic_nsAReadableString<CharT>&, PRUint32 pos );
virtual void Cut( PRUint32 pos, PRUint32 len );
protected:
virtual void do_AssignFromReadable( const basic_nsAReadableString<CharT>& );
// ...
};
@ -198,48 +195,16 @@ basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::GetWritableFragment( nsWri
template <class CharT, class TraitsT, class AllocatorT>
void
basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::Assign( const basic_nsAReadableString<CharT>& rhs )
basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::do_AssignFromReadable( const basic_nsAReadableString<CharT>& rhs )
{
typedef basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT> this_t;
if ( SameImplementation(*this, rhs) )
mRawString = NS_STATIC_CAST(this_t, rhs).mRawString;
else
{
mRawString.reserve(rhs.Length());
basic_nsAWritableString<CharT>::Assign(rhs);
}
basic_nsAWritableString<CharT>::do_AssignFromReadable(rhs);
}
template <class CharT, class TraitsT, class AllocatorT>
void
basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::Append( const basic_nsAReadableString<CharT>& rhs )
{
mRawString.append(rhs.BeginReading(), rhs.EndReading());
}
template <class CharT, class TraitsT, class AllocatorT>
void
basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::AppendChar( CharT c )
{
mRawString.append(1, c);
}
template <class CharT, class TraitsT, class AllocatorT>
void
basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::Insert( const basic_nsAReadableString<CharT>& rhs, PRUint32 atPosition )
{
mRawString.insert(mRawString.begin()+atPosition, rhs.BeginReading(), rhs.EndReading());
}
template <class CharT, class TraitsT, class AllocatorT>
void
basic_nsStdStringWrapper<CharT, TraitsT, AllocatorT>::Cut( PRUint32 cutStart, PRUint32 cutLength )
{
mRawString.erase(cutStart, cutLength);
}
typedef basic_nsStdStringWrapper<PRUnichar> nsStdString;
typedef basic_nsStdStringWrapper<char> nsStdCString;

Просмотреть файл

@ -277,7 +277,7 @@ test_repeated_append_char()
nsCString s1;
for ( int j=0; j<1000; ++j )
{
s1.AppendChar('e');
s1.Append('e');
len += TotalLength(s1);
}
}

Просмотреть файл

@ -1,5 +1,8 @@
#include <iostream.h>
#define TEST_STD_STRING
#include "nsString.h"
#include "nsSharedString.h"
#ifdef TEST_STD_STRING
@ -99,7 +102,7 @@ test_multifragment_iterators( const basic_nsAReadableString<CharT>& aString )
does not have the same bug. Make sure the first fragment is only one character long.
*/
{
typedef typename basic_nsAReadableString<CharT>::ConstIterator ConstIterator;
typedef typename basic_nsAReadableString<CharT>::const_iterator ConstIterator;
int tests_failed = 0;
@ -155,7 +158,7 @@ test_readable_hello( const basic_nsAReadableString<CharT>& aReadable )
++tests_failed;
}
basic_nsAReadableString<CharT>::ConstIterator iter = aReadable.BeginReading();
basic_nsAReadableString<CharT>::const_iterator iter = aReadable.BeginReading();
if ( *iter != CharT('H') )
{
cout << "FAILED |test_readable_hello|: didn't start out pointing to the right thing, or else couldn't be dereferenced. --> '" << *iter << "'" << endl;
@ -178,14 +181,14 @@ test_readable_hello( const basic_nsAReadableString<CharT>& aReadable )
++tests_failed;
}
basic_nsAReadableString<CharT>::ConstIterator iter1 = aReadable.BeginReading(3);
basic_nsAReadableString<CharT>::const_iterator iter1 = aReadable.BeginReading(3);
if ( *iter1 != CharT('l') )
{
cout << "FAILED |test_readable_hello|: iterator couldn't be set to |BeginReading(n)|, or else couldn't be dereferenced. --> '" << *iter1 << "'" << endl;
++tests_failed;
}
basic_nsAReadableString<CharT>::ConstIterator iter2 = aReadable.EndReading(2);
basic_nsAReadableString<CharT>::const_iterator iter2 = aReadable.EndReading(2);
if ( *iter2 != CharT('l') )
{
cout << "FAILED |test_readable_hello|: iterator couldn't be set to |EndReading(n)|, or else couldn't be dereferenced. --> '" << *iter2 << "'" << endl;