added some #ifdef logic to allow me to turn NEW_STRING_APIS off, so I can continue to profile for bloat; added an implementation specific |operator+()| to resolve ambiguity with promises on some platforms; added a conversion operator (against my best judgement) to |NS_ConvertASCIItoUCS2| to support the construction of literal strings induced by the bad case of the new macro. I could conditionally define this is the opposite direction.

This commit is contained in:
scc%mozilla.org 2000-06-11 01:06:14 +00:00
parent 7f51a498b1
commit 84e47f2424
3 changed files with 63 additions and 0 deletions

View File

@ -43,6 +43,11 @@
#define NEW_STRING_APIS 1
#endif //NEW_STRING_APIS
// Need this to enable comparison profiling for a while
#ifdef OLD_STRING_APIS
#undef NEW_STRING_APIS
#endif
#ifndef _nsString_
#define _nsString_
@ -892,6 +897,15 @@ NS_DEF_STRING_COMPARISON_OPERATORS(nsString, PRUnichar)
NS_DEF_DERIVED_STRING_OPERATOR_PLUS(nsString, PRUnichar)
#endif
#ifdef NEW_STRING_APIS
inline
nsPromiseConcatenation<PRUnichar>
operator+( const nsPromiseConcatenation<PRUnichar>& lhs, const nsString& rhs )
{
return nsPromiseConcatenation<PRUnichar>(lhs, rhs);
}
#endif
extern NS_COM int fputs(const nsString& aString, FILE* out);
//ostream& operator<<(ostream& aStream,const nsString& aString);
//virtual void DebugDump(ostream& aStream) const;
@ -975,6 +989,13 @@ class NS_COM NS_ConvertASCIItoUCS2
#endif
#endif
#ifdef NEW_STRING_APIS
operator nsLiteralString() const
{
return nsLiteralString(mUStr, mLength);
}
#endif
private:
// NOT TO BE IMPLEMENTED
NS_ConvertASCIItoUCS2( PRUnichar );

View File

@ -43,6 +43,11 @@
#define NEW_STRING_APIS 1
#endif //NEW_STRING_APIS
// Need this to enable comparison profiling for a while
#ifdef OLD_STRING_APIS
#undef NEW_STRING_APIS
#endif
#ifndef _nsString_
#define _nsString_
@ -892,6 +897,15 @@ NS_DEF_STRING_COMPARISON_OPERATORS(nsString, PRUnichar)
NS_DEF_DERIVED_STRING_OPERATOR_PLUS(nsString, PRUnichar)
#endif
#ifdef NEW_STRING_APIS
inline
nsPromiseConcatenation<PRUnichar>
operator+( const nsPromiseConcatenation<PRUnichar>& lhs, const nsString& rhs )
{
return nsPromiseConcatenation<PRUnichar>(lhs, rhs);
}
#endif
extern NS_COM int fputs(const nsString& aString, FILE* out);
//ostream& operator<<(ostream& aStream,const nsString& aString);
//virtual void DebugDump(ostream& aStream) const;
@ -975,6 +989,13 @@ class NS_COM NS_ConvertASCIItoUCS2
#endif
#endif
#ifdef NEW_STRING_APIS
operator nsLiteralString() const
{
return nsLiteralString(mUStr, mLength);
}
#endif
private:
// NOT TO BE IMPLEMENTED
NS_ConvertASCIItoUCS2( PRUnichar );

View File

@ -43,6 +43,11 @@
#define NEW_STRING_APIS 1
#endif //NEW_STRING_APIS
// Need this to enable comparison profiling for a while
#ifdef OLD_STRING_APIS
#undef NEW_STRING_APIS
#endif
#ifndef _nsString_
#define _nsString_
@ -892,6 +897,15 @@ NS_DEF_STRING_COMPARISON_OPERATORS(nsString, PRUnichar)
NS_DEF_DERIVED_STRING_OPERATOR_PLUS(nsString, PRUnichar)
#endif
#ifdef NEW_STRING_APIS
inline
nsPromiseConcatenation<PRUnichar>
operator+( const nsPromiseConcatenation<PRUnichar>& lhs, const nsString& rhs )
{
return nsPromiseConcatenation<PRUnichar>(lhs, rhs);
}
#endif
extern NS_COM int fputs(const nsString& aString, FILE* out);
//ostream& operator<<(ostream& aStream,const nsString& aString);
//virtual void DebugDump(ostream& aStream) const;
@ -975,6 +989,13 @@ class NS_COM NS_ConvertASCIItoUCS2
#endif
#endif
#ifdef NEW_STRING_APIS
operator nsLiteralString() const
{
return nsLiteralString(mUStr, mLength);
}
#endif
private:
// NOT TO BE IMPLEMENTED
NS_ConvertASCIItoUCS2( PRUnichar );