This commit is contained in:
ftang%netscape.com 1999-06-07 21:37:45 +00:00
Родитель 54b761eadc
Коммит 91e96a948c
41 изменённых файлов: 94 добавлений и 39 удалений

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

@ -19,6 +19,7 @@
#include "pratom.h"
#include "nsIComponentManager.h"
#include "nsICharRepresentable.h"
#include "nsUCvLatinSupport.h"
#include "nsUCvLatinDll.h"
@ -492,8 +493,13 @@ nsresult nsEncoderSupport::QueryInterface(REFNSIID aIID,
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(nsICharRepresentable::GetIID())) {
*aInstancePtr = (void*) ((nsICharRepresentable*)this);
NS_ADDREF_THIS();
return NS_OK;
}
if (aIID.Equals(kISupportsIID)) {
*aInstancePtr = (void*) ((nsISupports*)this);
*aInstancePtr = (void*) ((nsISupports*)((nsIUnicodeEncoder*)this));
NS_ADDREF_THIS();
return NS_OK;
}
@ -630,6 +636,20 @@ nsTableEncoderSupport::~nsTableEncoderSupport()
NS_IF_RELEASE(mHelper);
}
NS_IMETHODIMP nsTableEncoderSupport::FillInfo(PRUint32 *aInfo)
{
nsresult res;
if (mHelper == nsnull) {
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
kIUnicodeEncodeHelperIID, (void**) & mHelper);
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
}
res = mHelper->FillInfo(aInfo, mMappingTable);
return res;
}
//----------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [implementation]
@ -673,6 +693,20 @@ nsMultiTableEncoderSupport::~nsMultiTableEncoderSupport()
NS_IF_RELEASE(mHelper);
}
NS_IMETHODIMP nsMultiTableEncoderSupport::FillInfo(PRUint32 *aInfo)
{
nsresult res;
if (mHelper == nsnull) {
res = nsComponentManager::CreateInstance(kUnicodeEncodeHelperCID, NULL,
kIUnicodeEncodeHelperIID, (void**) & mHelper);
if (NS_FAILED(res)) return NS_ERROR_UENC_NOHELPER;
}
res = mHelper->FillInfo(aInfo,mTableCount, mMappingTable);
return res;
}
//----------------------------------------------------------------------
// Subclassing of nsEncoderSupport class [implementation]

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

@ -24,6 +24,7 @@
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncodeHelper.h"
#include "nsIUnicodeDecodeHelper.h"
#include "nsICharRepresentable.h"
#define ONE_BYTE_TABLE_SIZE 256
@ -264,7 +265,7 @@ protected:
* @created 17/Feb/1999
* @author Catalin Rotaru [CATA]
*/
class nsEncoderSupport : public nsIUnicodeEncoder
class nsEncoderSupport : public nsIUnicodeEncoder, public nsICharRepresentable
{
NS_DECL_ISUPPORTS
@ -330,6 +331,10 @@ public:
NS_IMETHOD Reset();
NS_IMETHOD SetOutputErrorBehavior(PRInt32 aBehavior,
nsIUnicharEncoder * aEncoder, PRUnichar aChar);
//--------------------------------------------------------------------
// Interface nsICharRepresentable [declaration]
NS_IMETHOD FillInfo(PRUint32 *aInfo) = 0;
};
//----------------------------------------------------------------------
@ -355,6 +360,7 @@ public:
* Class destructor.
*/
virtual ~nsTableEncoderSupport();
NS_IMETHOD FillInfo( PRUint32 *aInfo);
protected:
@ -392,6 +398,7 @@ public:
* Class destructor.
*/
virtual ~nsMultiTableEncoderSupport();
NS_IMETHOD FillInfo( PRUint32 *aInfo);
protected:

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

@ -42,7 +42,7 @@ nsUnicodeToARMSCII8::nsUnicodeToARMSCII8()
nsresult nsUnicodeToARMSCII8::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToARMSCII8();
*aResult = (nsIUnicodeEncoder*)new nsUnicodeToARMSCII8();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1250::nsUnicodeToCP1250()
nsresult nsUnicodeToCP1250::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1250();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1250();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1251::nsUnicodeToCP1251()
nsresult nsUnicodeToCP1251::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1251();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1251();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1252::nsUnicodeToCP1252()
nsresult nsUnicodeToCP1252::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1252();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1252();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1253::nsUnicodeToCP1253()
nsresult nsUnicodeToCP1253::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1253();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1253();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1254::nsUnicodeToCP1254()
nsresult nsUnicodeToCP1254::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1254();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1254();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1257::nsUnicodeToCP1257()
nsresult nsUnicodeToCP1257::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1257();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1257();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP1258::nsUnicodeToCP1258()
nsresult nsUnicodeToCP1258::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP1258();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP1258();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToCP874::nsUnicodeToCP874()
nsresult nsUnicodeToCP874::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToCP874();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToCP874();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88591::nsUnicodeToISO88591()
nsresult nsUnicodeToISO88591::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88591();
*aResult = (nsIUnicodeEncoder *) new nsUnicodeToISO88591();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}
@ -56,3 +56,4 @@ NS_IMETHODIMP nsUnicodeToISO88591::GetMaxLength(const PRUnichar * aSrc,
*aDestLength = aSrcLength;
return NS_OK_UENC_EXACTLENGTH;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO885914::nsUnicodeToISO885914()
nsresult nsUnicodeToISO885914::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO885914();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO885914();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO885915::nsUnicodeToISO885915()
nsresult nsUnicodeToISO885915::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO885915();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO885915();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88592::nsUnicodeToISO88592()
nsresult nsUnicodeToISO88592::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88592();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88592();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88593::nsUnicodeToISO88593()
nsresult nsUnicodeToISO88593::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88593();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88593();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88594::nsUnicodeToISO88594()
nsresult nsUnicodeToISO88594::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88594();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88594();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88595::nsUnicodeToISO88595()
nsresult nsUnicodeToISO88595::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88595();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88595();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88596::nsUnicodeToISO88596()
nsresult nsUnicodeToISO88596::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88596();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88596();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88597::nsUnicodeToISO88597()
nsresult nsUnicodeToISO88597::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88597();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88597();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88598::nsUnicodeToISO88598()
nsresult nsUnicodeToISO88598::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88598();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88598();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToISO88599::nsUnicodeToISO88599()
nsresult nsUnicodeToISO88599::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToISO88599();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToISO88599();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToKOI8R::nsUnicodeToKOI8R()
nsresult nsUnicodeToKOI8R::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToKOI8R();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToKOI8R();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToKOI8U::nsUnicodeToKOI8U()
nsresult nsUnicodeToKOI8U::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToKOI8U();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToKOI8U();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -29,6 +29,6 @@ nsUnicodeToMUTF7::nsUnicodeToMUTF7()
nsresult nsUnicodeToMUTF7::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMUTF7();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMUTF7();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacCE::nsUnicodeToMacCE()
nsresult nsUnicodeToMacCE::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacCE();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacCE();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacCroatian::nsUnicodeToMacCroatian()
nsresult nsUnicodeToMacCroatian::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacCroatian();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacCroatian();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacCyrillic::nsUnicodeToMacCyrillic()
nsresult nsUnicodeToMacCyrillic::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacCyrillic();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacCyrillic();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacGreek::nsUnicodeToMacGreek()
nsresult nsUnicodeToMacGreek::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacGreek();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacGreek();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacIcelandic::nsUnicodeToMacIcelandic()
nsresult nsUnicodeToMacIcelandic::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacIcelandic();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacIcelandic();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacRoman::nsUnicodeToMacRoman()
nsresult nsUnicodeToMacRoman::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacRoman();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacRoman();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacRomanian::nsUnicodeToMacRomanian()
nsresult nsUnicodeToMacRomanian::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacRomanian();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacRomanian();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacTurkish::nsUnicodeToMacTurkish()
nsresult nsUnicodeToMacTurkish::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacTurkish();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacTurkish();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToMacUkrainian::nsUnicodeToMacUkrainian()
nsresult nsUnicodeToMacUkrainian::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToMacUkrainian();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToMacUkrainian();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToTCVN5712::nsUnicodeToTCVN5712()
nsresult nsUnicodeToTCVN5712::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToTCVN5712();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToTCVN5712();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -36,6 +36,11 @@ nsBasicUTF7Encoder::nsBasicUTF7Encoder(char aLastChar, char aEscChar)
Reset();
}
NS_IMETHODIMP nsBasicUTF7Encoder::FillInfo(PRUint32 *aInfo)
{
memset(aInfo, 0xFF, (0x10000L >> 3));
return NS_OK;
}
nsresult nsBasicUTF7Encoder::ShiftEncoding(PRInt32 aEncoding,
char * aDest,
PRInt32 * aDestLength)
@ -290,6 +295,6 @@ nsUnicodeToUTF7::nsUnicodeToUTF7()
nsresult nsUnicodeToUTF7::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToUTF7();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToUTF7();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -40,6 +40,7 @@ public:
*/
nsBasicUTF7Encoder(char aLastChar, char aEscChar);
NS_IMETHOD FillInfo(PRUint32 *aInfo);
protected:
PRInt32 mEncoding; // current encoding

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

@ -44,7 +44,7 @@ nsUnicodeToUTF8::nsUnicodeToUTF8()
nsresult nsUnicodeToUTF8::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToUTF8();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToUTF8();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}
@ -58,3 +58,8 @@ NS_IMETHODIMP nsUnicodeToUTF8::GetMaxLength(const PRUnichar * aSrc,
*aDestLength = 3*aSrcLength;
return NS_OK;
}
NS_IMETHODIMP nsUnicodeToUTF8::FillInfo(PRUint32 *aInfo)
{
memset(aInfo, 0xFF, (0x10000L >> 3));
return NS_OK;
}

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

@ -44,6 +44,8 @@ public:
* Static class constructor.
*/
static nsresult CreateInstance(nsISupports **aResult);
NS_IMETHOD FillInfo(PRUint32* aInfo);
protected:

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

@ -42,7 +42,7 @@ nsUnicodeToVISCII::nsUnicodeToVISCII()
nsresult nsUnicodeToVISCII::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToVISCII();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToVISCII();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}

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

@ -42,7 +42,7 @@ nsUnicodeToVPS::nsUnicodeToVPS()
nsresult nsUnicodeToVPS::CreateInstance(nsISupports ** aResult)
{
*aResult = new nsUnicodeToVPS();
*aResult = (nsIUnicodeEncoder*) new nsUnicodeToVPS();
return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK;
}