Backing out last change because of test failures on tinderbox.

This commit is contained in:
smontagu%smontagu.org 2004-01-21 08:06:12 +00:00
Родитель e53da56cd5
Коммит 9c629f6331
3 изменённых файлов: 98 добавлений и 0 удалений

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

@ -73,6 +73,11 @@ public:
NS_IMETHOD ToTitle( const PRUnichar* anArray, PRUnichar* aReturn,
PRUint32 aLen, PRBool aStartInWordBundary=PR_TRUE) = 0;
// The following nsString flavor one know how to handle special casing
NS_IMETHOD ToUpper(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale=nsnull) = 0;
NS_IMETHOD ToLower(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale=nsnull ) = 0;
NS_IMETHOD ToTitle(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale=nsnull, PRBool aStartInWordBoundary=PR_TRUE) = 0;
// case-insensitive PRUnichar* comparison - aResult returns similar
// to strcasecmp
NS_IMETHOD CaseInsensitiveCompare(const PRUnichar* aLeft, const PRUnichar* aRight, PRUint32 aLength, PRInt32* aResult) = 0;

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

@ -340,6 +340,96 @@ nsresult nsCaseConversionImp2::ToTitle(
return NS_OK;
}
#define k_ss 0x00df
#define kDot_I 0x0130
#define kDot_i PRUnichar('i')
#define kDotLess_I PRUnichar('I')
#define kDotLess_i 0x0131
NS_IMETHODIMP nsCaseConversionImp2::ToUpper
(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale)
{
anOut.Assign(anIn,aLen);
// Special casing - Turkish dotless I
if((nsnull != aLocale ) && (PRUnichar('t')==aLocale[0]) && (PRUnichar('r') == aLocale[1]))
{
for(PRUnichar* s=(PRUnichar*)anOut.get(); *s ; s++)
{
if(kDot_i == *s)
*s = kDot_I;
}
}
ToUpper(anOut.get(), (PRUnichar*)anOut.get(), anOut.Length());
// Special casing - SS
PRInt32 idx=0;
for(PRUnichar* s=(PRUnichar*)anOut.get(); *s ; s++,idx++)
{
if(k_ss == *s) {
*s = PRUnichar('S') ;
anOut.Insert(PRUnichar('S'),idx);
// Insert may cause reallocate, so we need to get() again
s = (PRUnichar*)anOut.get() + idx;
idx++;
}
}
return NS_OK;
}
NS_IMETHODIMP nsCaseConversionImp2::ToLower
(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale)
{
anOut.Assign(anIn,aLen);
// Special casing - Turkish dotless I
if((nsnull != aLocale ) && (PRUnichar('t')==aLocale[0]) && (PRUnichar('r') == aLocale[1]))
{
for(PRUnichar* s=(PRUnichar*)anOut.get(); *s ; s++)
{
if(kDot_I == *s)
*s = kDot_I;
}
}
ToLower(anOut.get(), (PRUnichar*)anOut.get(), anOut.Length());
return NS_OK;
}
NS_IMETHODIMP nsCaseConversionImp2::ToTitle
(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale,
PRBool aStartInWordBoundary)
{
anOut.Assign(anIn,aLen);
// Special casing - Turkish dotless I
if((nsnull != aLocale ) && (PRUnichar('t')==aLocale[0]) && (PRUnichar('r') == aLocale[1]))
{
for(PRUnichar* s=(PRUnichar*)anOut.get(); *s ; s++)
{
if(kDot_i == *s)
*s = kDot_I;
}
}
ToTitle(anOut.get(), (PRUnichar*)anOut.get(), anOut.Length(),
aStartInWordBoundary);
// Special casing - SS
PRInt32 idx=0;
for(PRUnichar* s=(PRUnichar*)anOut.get(); *s ; s++,idx++)
{
if(k_ss == *s) {
*s = PRUnichar('S') ;
anOut.Insert(PRUnichar('S'),idx);
// Insert may cause reallocate, so we need to get() again
s = (PRUnichar*)anOut.get() + idx;
idx++;
}
}
return NS_OK;
}
// implementation moved from the old nsCRT routine
NS_IMETHODIMP
nsCaseConversionImp2::CaseInsensitiveCompare(const PRUnichar *aLeft,

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

@ -67,6 +67,9 @@ public:
NS_IMETHOD ToTitle(const PRUnichar* anArray, PRUnichar* aReturn,
PRUint32 aLen, PRBool aStartInWordBoundary = PR_TRUE);
NS_IMETHOD ToUpper(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale=nsnull) ;
NS_IMETHOD ToLower(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale=nsnull );
NS_IMETHOD ToTitle(const PRUnichar* anIn, PRUint32 aLen, nsString& anOut, const PRUnichar* aLocale=nsnull, PRBool aStartInWordBoundary=PR_TRUE) ;
NS_IMETHOD CaseInsensitiveCompare(const PRUnichar* aLeft, const PRUnichar* aRight, PRUint32 aLength, PRInt32 *aResult);
private:
static nsrefcnt gInit;