diff --git a/intl/uconv/ucvlatin/nsISOIR111ToUnicode.cpp b/intl/uconv/ucvlatin/nsISOIR111ToUnicode.cpp index 68df01bea645..5cf30262b4cc 100644 --- a/intl/uconv/ucvlatin/nsISOIR111ToUnicode.cpp +++ b/intl/uconv/ucvlatin/nsISOIR111ToUnicode.cpp @@ -1,17 +1,47 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/NPL/ * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. */ + +#include "nsISOIR111ToUnicode.h" + +//---------------------------------------------------------------------- +// Global functions and data [declaration] + +static PRUint16 g_utMappingTable[] = { +#include "iso-ir-111.ut" +}; + +static PRInt16 g_utShiftTable[] = { + 0, u1ByteCharset , + ShiftCell(0,0,0,0,0,0,0,0) +}; + +//---------------------------------------------------------------------- +// Class nsISOIR111ToUnicode [implementation] + +nsISOIR111ToUnicode::nsISOIR111ToUnicode() +: nsOneByteDecoderSupport((uShiftTable*) &g_utShiftTable, + (uMappingTable*) &g_utMappingTable) +{ +} + +nsresult nsISOIR111ToUnicode::CreateInstance(nsISupports ** aResult) +{ + *aResult = new nsISOIR111ToUnicode(); + return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK; +} diff --git a/intl/uconv/ucvlatin/nsISOIR111ToUnicode.h b/intl/uconv/ucvlatin/nsISOIR111ToUnicode.h index 68df01bea645..ac6c91a4ec2c 100644 --- a/intl/uconv/ucvlatin/nsISOIR111ToUnicode.h +++ b/intl/uconv/ucvlatin/nsISOIR111ToUnicode.h @@ -1,17 +1,49 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/NPL/ * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. */ + +#ifndef nsISOIR111ToUnicode_h___ +#define nsISOIR111ToUnicode_h___ + +#include "nsUCvLatinSupport.h" + +//---------------------------------------------------------------------- +// Class nsISOIR111ToUnicode [declaration] + +/** + * A character set converter from ISOIR111 to Unicode. + * + * @created 23/Nov/1998 + * @author Catalin Rotaru [CATA] + */ +class nsISOIR111ToUnicode : public nsOneByteDecoderSupport +{ +public: + + /** + * Class constructor. + */ + nsISOIR111ToUnicode(); + + /** + * Static class constructor. + */ + static nsresult CreateInstance(nsISupports **aResult); +}; + +#endif /* nsISOIR111ToUnicode_h___ */ diff --git a/intl/uconv/ucvlatin/nsUnicodeToISOIR111.cpp b/intl/uconv/ucvlatin/nsUnicodeToISOIR111.cpp index 68df01bea645..2661ebdb874e 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToISOIR111.cpp +++ b/intl/uconv/ucvlatin/nsUnicodeToISOIR111.cpp @@ -1,17 +1,59 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/NPL/ * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. */ + +#include "nsUnicodeToISOIR111.h" + +//---------------------------------------------------------------------- +// Global functions and data [declaration] + +static PRUint16 g_ufMappingTable[] = { +#include "iso-ir-111.uf" +}; + +static PRInt16 g_ufShiftTable[] = { + 0, u1ByteCharset , + ShiftCell(0,0,0,0,0,0,0,0) +}; + +//---------------------------------------------------------------------- +// Class nsUnicodeToISOIR111 [implementation] + +nsUnicodeToISOIR111::nsUnicodeToISOIR111() +: nsTableEncoderSupport((uShiftTable*) &g_ufShiftTable, + (uMappingTable*) &g_ufMappingTable) +{ +} + +nsresult nsUnicodeToISOIR111::CreateInstance(nsISupports ** aResult) +{ + *aResult = (nsIUnicodeEncoder *) new nsUnicodeToISOIR111(); + return (*aResult == NULL)? NS_ERROR_OUT_OF_MEMORY : NS_OK; +} + +//---------------------------------------------------------------------- +// Subclassing of nsTableEncoderSupport class [implementation] + +NS_IMETHODIMP nsUnicodeToISOIR111::GetMaxLength(const PRUnichar * aSrc, + PRInt32 aSrcLength, + PRInt32 * aDestLength) +{ + *aDestLength = aSrcLength; + return NS_OK_UENC_EXACTLENGTH; +} + diff --git a/intl/uconv/ucvlatin/nsUnicodeToISOIR111.h b/intl/uconv/ucvlatin/nsUnicodeToISOIR111.h index 68df01bea645..52da900ba896 100644 --- a/intl/uconv/ucvlatin/nsUnicodeToISOIR111.h +++ b/intl/uconv/ucvlatin/nsUnicodeToISOIR111.h @@ -1,17 +1,57 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * * The contents of this file are subject to the Netscape Public License - * Version 1.0 (the "NPL"); you may not use this file except in - * compliance with the NPL. You may obtain a copy of the NPL at + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/NPL/ * - * Software distributed under the NPL is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL - * for the specific language governing rights and limitations under the - * NPL. + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. * - * The Initial Developer of this code under the NPL is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights - * Reserved. + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. */ + +#ifndef nsUnicodeToISOIR111_h___ +#define nsUnicodeToISOIR111_h___ + +#include "nsUCvLatinSupport.h" + +//---------------------------------------------------------------------- +// Class nsUnicodeToISOIR111 [declaration] + +/** + * A character set converter from Unicode to ISOIR111. + * + * @created 17/Feb/1999 + * @author Catalin Rotaru [CATA] + */ +class nsUnicodeToISOIR111 : public nsTableEncoderSupport +{ +public: + + /** + * Class constructor. + */ + nsUnicodeToISOIR111(); + + /** + * Static class constructor. + */ + static nsresult CreateInstance(nsISupports **aResult); + +protected: + + //-------------------------------------------------------------------- + // Subclassing of nsEncoderSupport class [declaration] + + NS_IMETHOD GetMaxLength(const PRUnichar * aSrc, PRInt32 aSrcLength, + PRInt32 * aDestLength); +}; + +#endif /* nsUnicodeToISOIR111_h___ */