added comments and made some changes suggested by reviewers; still not in the build

git-svn-id: svn://10.0.0.236/trunk@75634 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%mozilla.org
2000-08-05 04:25:49 +00:00
parent 3b6ca9fa3d
commit d1f2f5f430
6 changed files with 216 additions and 21 deletions

View File

@@ -28,6 +28,11 @@
/**
* A character sink that performs a |reinterpret_cast| style conversion between character types.
*/
template <class FromCharT, class ToCharT>
class LossyConvertEncoding
{
@@ -59,6 +64,15 @@ class LossyConvertEncoding
output_type* mDestination;
};
/**
* 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).
*
* @param aSource an string you will eventually be making a copy of
* @return a new buffer (of the type specified by the second parameter) which you must free with |nsMemory::Free|.
*
*/
template <class FromCharT, class ToCharT>
inline
ToCharT*
@@ -107,8 +121,7 @@ ToNewUnicode( const nsAReadableCString& aSource )
PRBool
IsASCII( const nsAReadableString& aString )
{
const PRUnichar NOT_ASCII = PRUnichar(~0x007F);
static const PRUnichar NOT_ASCII = PRUnichar(~0x007F);
// Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character