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
git-svn-id: svn://10.0.0.236/trunk@143925 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
c6f21660b5
commit
5bea629223
@ -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).
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user