Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
CMHTranslator Class Reference

#include <nsImportTranslator.h>

Inheritance diagram for CMHTranslator:
Inheritance graph
[legend]
Collaboration diagram for CMHTranslator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual PRUint32 GetMaxBufferSize (PRUint32 inLen)
virtual void ConvertBuffer (const PRUint8 *pIn, PRUint32 inLen, PRUint8 *pOut)
virtual PRBool ConvertToFile (const PRUint8 *pIn, PRUint32 inLen, ImportOutFile *pOutFile, PRUint32 *pProcessed=nsnull)
virtual PRBool Supports8bitEncoding (void)
virtual PRBool FinishConvertToFile (ImportOutFile *)
virtual void GetCharset (nsCString &charSet)
virtual void GetLanguage (nsCString &lang)
virtual void GetEncoding (nsCString &encoding)

Detailed Description

Definition at line 70 of file nsImportTranslator.h.


Member Function Documentation

void CMHTranslator::ConvertBuffer ( const PRUint8 pIn,
PRUint32  inLen,
PRUint8 pOut 
) [virtual]

Reimplemented from nsImportTranslator.

Definition at line 51 of file nsImportTranslator.cpp.

{
       while (inLen) {
              if (!ImportCharSet::IsUSAscii( *pIn) || ImportCharSet::Is822SpecialChar( *pIn) || ImportCharSet::Is822CtlChar( *pIn) ||
                     (*pIn == ImportCharSet::cSpaceChar) || (*pIn == '*') || (*pIn == '\'') ||
                     (*pIn == '%')) {
                     // needs to be encode as %hex val
                     *pOut = '%'; pOut++;
                     ImportCharSet::ByteToHex( *pIn, pOut);
                     pOut += 2;
              }
              else {
                     *pOut = *pIn;
                     pOut++;
              }
              pIn++; inLen--;
       }
       *pOut = 0;
}

Here is the call graph for this function:

PRBool CMHTranslator::ConvertToFile ( const PRUint8 pIn,
PRUint32  inLen,
ImportOutFile pOutFile,
PRUint32 pProcessed = nsnull 
) [virtual]

Reimplemented from nsImportTranslator.

Definition at line 71 of file nsImportTranslator.cpp.

{
       PRUint8              hex[2];
       while (inLen) {
              if (!ImportCharSet::IsUSAscii( *pIn) || ImportCharSet::Is822SpecialChar( *pIn) || ImportCharSet::Is822CtlChar( *pIn) ||
                     (*pIn == ImportCharSet::cSpaceChar) || (*pIn == '*') || (*pIn == '\'') ||
                     (*pIn == '%')) {
                     // needs to be encode as %hex val
                     if (!pOutFile->WriteByte( '%'))
                            return( PR_FALSE);
                     ImportCharSet::ByteToHex( *pIn, hex);
                     if (!pOutFile->WriteData( hex, 2))
                            return( PR_FALSE);
              }
              else {
                     if (!pOutFile->WriteByte( *pIn))
                            return( PR_FALSE);
              }
              pIn++; inLen--;
       }

       if (pProcessed)
              *pProcessed = inLen;

       return( PR_TRUE);
}

Here is the call graph for this function:

virtual PRBool nsImportTranslator::FinishConvertToFile ( ImportOutFile ) [inline, virtual, inherited]

Definition at line 61 of file nsImportTranslator.h.

{ return( PR_TRUE);}

Here is the caller graph for this function:

virtual void nsImportTranslator::GetCharset ( nsCString charSet) [inline, virtual, inherited]

Definition at line 63 of file nsImportTranslator.h.

{ charSet = "us-ascii";}

Here is the caller graph for this function:

virtual void nsImportTranslator::GetEncoding ( nsCString encoding) [inline, virtual, inherited]

Definition at line 65 of file nsImportTranslator.h.

{ encoding.Truncate();}

Here is the caller graph for this function:

virtual void nsImportTranslator::GetLanguage ( nsCString lang) [inline, virtual, inherited]

Definition at line 64 of file nsImportTranslator.h.

{ lang = "en";}

Here is the caller graph for this function:

virtual PRUint32 CMHTranslator::GetMaxBufferSize ( PRUint32  inLen) [inline, virtual]

Reimplemented from nsImportTranslator.

Definition at line 72 of file nsImportTranslator.h.

{ return( (inLen * 3) + 1);}
virtual PRBool nsImportTranslator::Supports8bitEncoding ( void  ) [inline, virtual, inherited]

Definition at line 57 of file nsImportTranslator.h.

{ return( PR_FALSE);}

Here is the caller graph for this function:


The documentation for this class was generated from the following files: