sl@0: /* sl@0: * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: This file is a source code file for a charconv plug-in. sl@0: * This plug-in supports EUC-KR. sl@0: * sl@0: */ sl@0: sl@0: sl@0: sl@0: // INCLUDES sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include "cp949table.h" sl@0: #include "charactersetconverter.h" sl@0: // New Interface class sl@0: class CEUCKRImplementation : public CCharacterSetConverterPluginInterface sl@0: { sl@0: public: sl@0: virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters(); sl@0: sl@0: virtual TInt ConvertFromUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, sl@0: TDes8& aForeign, sl@0: const TDesC16& aUnicode, sl@0: CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters ); sl@0: sl@0: virtual TInt ConvertToUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: TDes16& aUnicode, sl@0: const TDesC8& aForeign, sl@0: TInt&, sl@0: TInt& aNumberOfUnconvertibleCharacters, sl@0: TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter ); sl@0: sl@0: virtual TBool IsInThisCharacterSetL( sl@0: TBool& aSetToTrue, sl@0: TInt& aConfidenceLevel, sl@0: const TDesC8& ); sl@0: sl@0: static CEUCKRImplementation* NewL(); sl@0: sl@0: virtual ~CEUCKRImplementation(); sl@0: sl@0: private: sl@0: CEUCKRImplementation(); sl@0: }; sl@0: sl@0: // FUNCTION DEFINITIONS sl@0: const TDesC8& CEUCKRImplementation::ReplacementForUnconvertibleUnicodeCharacters() sl@0: { sl@0: return CnvCp949Table::ReplacementForUnconvertibleUnicodeCharacters(); sl@0: } sl@0: sl@0: TInt CEUCKRImplementation::ConvertFromUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, sl@0: TDes8& aForeign, sl@0: const TDesC16& aUnicode, sl@0: CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters) sl@0: { sl@0: return CCnvCharacterSetConverter::DoConvertFromUnicode(CnvCp949Table::ConversionData(), aDefaultEndiannessOfForeignCharacters, aReplacementForUnconvertibleUnicodeCharacters, aForeign, aUnicode, aIndicesOfUnconvertibleCharacters); sl@0: } sl@0: sl@0: TInt CEUCKRImplementation::ConvertToUnicode( sl@0: CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, sl@0: TDes16& aUnicode, sl@0: const TDesC8& aForeign, sl@0: TInt&, sl@0: TInt& aNumberOfUnconvertibleCharacters, sl@0: TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter) sl@0: { sl@0: return CCnvCharacterSetConverter::DoConvertToUnicode(CnvCp949Table::ConversionData(), aDefaultEndiannessOfForeignCharacters, aUnicode, aForeign, aNumberOfUnconvertibleCharacters, aIndexOfFirstByteOfFirstUnconvertibleCharacter); sl@0: } sl@0: sl@0: sl@0: TBool CEUCKRImplementation::IsInThisCharacterSetL( sl@0: TBool& aSetToTrue, sl@0: TInt& aConfidenceLevel, sl@0: const TDesC8& /*aBuf*/) sl@0: { sl@0: /* sl@0: aSetToTrue=ETrue; sl@0: aConfidenceLevel=50; sl@0: sl@0: TUint8 ch(0); sl@0: for (TInt i=0;i