зеркало из https://github.com/mozilla/pjs.git
Fixing part of bug 209699 (and more of bug 87677). Implement char* and PRUnichar* versions of Copy/AppendUTF*toUTF*(). r=alecf@flett.org, r=dbaron@dbaron.org, sr=jaggernaut@netscape.com
This commit is contained in:
Родитель
aad539534d
Коммит
76652928b5
|
@ -47,12 +47,19 @@ NS_COM size_t Distance( const nsReadingIterator<char>&, const nsReadingIterator<
|
|||
|
||||
NS_COM void CopyUCS2toASCII( const nsAString& aSource, nsACString& aDest );
|
||||
NS_COM void CopyASCIItoUCS2( const nsACString& aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
|
||||
NS_COM void CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest );
|
||||
NS_COM void CopyUTF8toUTF16( const char* aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
|
||||
NS_COM void AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void AppendUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest );
|
||||
NS_COM void AppendUTF8toUTF16( const char* aSource, nsAString& aDest );
|
||||
|
||||
/**
|
||||
* Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
|
||||
*
|
||||
|
|
|
@ -192,6 +192,22 @@ CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
|
|||
AppendUTF8toUTF16(aSource, aDest);
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest )
|
||||
{
|
||||
aDest.Truncate();
|
||||
AppendUTF16toUTF8(aSource, aDest);
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
CopyUTF8toUTF16( const char* aSource, nsAString& aDest )
|
||||
{
|
||||
aDest.Truncate();
|
||||
AppendUTF8toUTF16(aSource, aDest);
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest )
|
||||
|
@ -301,6 +317,24 @@ AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
|
|||
}
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
AppendUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest )
|
||||
{
|
||||
if (aSource) {
|
||||
AppendUTF16toUTF8(nsDependentString(aSource), aDest);
|
||||
}
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
AppendUTF8toUTF16( const char* aSource, nsAString& aDest )
|
||||
{
|
||||
if (aSource) {
|
||||
AppendUTF8toUTF16(nsDependentCString(aSource), aDest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator).
|
||||
|
|
|
@ -47,12 +47,19 @@ NS_COM size_t Distance( const nsReadingIterator<char>&, const nsReadingIterator<
|
|||
|
||||
NS_COM void CopyUCS2toASCII( const nsAString& aSource, nsACString& aDest );
|
||||
NS_COM void CopyASCIItoUCS2( const nsACString& aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
|
||||
NS_COM void CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest );
|
||||
NS_COM void CopyUTF8toUTF16( const char* aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
|
||||
NS_COM void AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest );
|
||||
|
||||
NS_COM void AppendUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest );
|
||||
NS_COM void AppendUTF8toUTF16( const char* aSource, nsAString& aDest );
|
||||
|
||||
/**
|
||||
* Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
|
||||
*
|
||||
|
|
|
@ -192,6 +192,22 @@ CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
|
|||
AppendUTF8toUTF16(aSource, aDest);
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
CopyUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest )
|
||||
{
|
||||
aDest.Truncate();
|
||||
AppendUTF16toUTF8(aSource, aDest);
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
CopyUTF8toUTF16( const char* aSource, nsAString& aDest )
|
||||
{
|
||||
aDest.Truncate();
|
||||
AppendUTF8toUTF16(aSource, aDest);
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest )
|
||||
|
@ -301,6 +317,24 @@ AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
|
|||
}
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
AppendUTF16toUTF8( const PRUnichar* aSource, nsACString& aDest )
|
||||
{
|
||||
if (aSource) {
|
||||
AppendUTF16toUTF8(nsDependentString(aSource), aDest);
|
||||
}
|
||||
}
|
||||
|
||||
NS_COM
|
||||
void
|
||||
AppendUTF8toUTF16( const char* aSource, nsAString& aDest )
|
||||
{
|
||||
if (aSource) {
|
||||
AppendUTF8toUTF16(nsDependentCString(aSource), aDest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator).
|
||||
|
|
Загрузка…
Ссылка в новой задаче