os/textandloc/charconvfw/charconvplugins/src/plugins/Win1258.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 /*
     2 * Copyright (c) 1258 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:     
    15 *
    16 */
    17 
    18 
    19 
    20 
    21 
    22 // INCLUDES
    23 #include <e32std.h>
    24 #include <charconv.h>
    25 #include <convgeneratedcpp.h>
    26 #include <ecom/implementationproxy.h>
    27 #include <charactersetconverter.h>
    28 // New Interface class
    29 class CWin1258Implementation : public CCharacterSetConverterPluginInterface
    30 {
    31     public:
    32         virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
    33 
    34         virtual TInt ConvertFromUnicode(
    35             CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    36             const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
    37             TDes8& aForeign, 
    38             const TDesC16& aUnicode, 
    39             CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters );
    40 
    41         virtual TInt ConvertToUnicode(
    42             CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    43             TDes16& aUnicode, 
    44             const TDesC8& aForeign, 
    45             TInt&, 
    46             TInt& aNumberOfUnconvertibleCharacters, 
    47             TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter );
    48 
    49         virtual TBool IsInThisCharacterSetL(
    50             TBool& aSetToTrue, 
    51             TInt& aConfidenceLevel, 
    52             const TDesC8& );
    53 
    54         static CWin1258Implementation* NewL();
    55 
    56         virtual ~CWin1258Implementation();
    57     private:
    58         CWin1258Implementation();
    59 };
    60 
    61 const TDesC8& CWin1258Implementation::ReplacementForUnconvertibleUnicodeCharacters()
    62 	{
    63 	return ReplacementForUnconvertibleUnicodeCharacters_internal();
    64 	}
    65 
    66 TInt CWin1258Implementation::ConvertFromUnicode(
    67     CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    68     const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
    69     TDes8& aForeign, 
    70     const TDesC16& aUnicode, 
    71     CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters )
    72 	{
    73 	return CCnvCharacterSetConverter::DoConvertFromUnicode(
    74         conversionData, 
    75         aDefaultEndiannessOfForeignCharacters, 
    76         aReplacementForUnconvertibleUnicodeCharacters, 
    77         aForeign, 
    78         aUnicode, 
    79         aIndicesOfUnconvertibleCharacters );
    80 	}
    81 
    82 TInt CWin1258Implementation::ConvertToUnicode(
    83     CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    84     TDes16& aUnicode, 
    85     const TDesC8& aForeign, 
    86     TInt&, 
    87     TInt& aNumberOfUnconvertibleCharacters, 
    88     TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter )
    89 	{
    90     return CCnvCharacterSetConverter::DoConvertToUnicode(
    91         conversionData, 
    92         aDefaultEndiannessOfForeignCharacters, 
    93         aUnicode, 
    94         aForeign, 
    95         aNumberOfUnconvertibleCharacters, 
    96         aIndexOfFirstByteOfFirstUnconvertibleCharacter );
    97 	}
    98 
    99 TBool CWin1258Implementation::IsInThisCharacterSetL(
   100     TBool& aSetToTrue, 
   101     TInt& aConfidenceLevel, 
   102     const TDesC8& )
   103 	{
   104     aSetToTrue=EFalse;
   105 	aConfidenceLevel=0;
   106 	return EFalse;
   107 	}
   108 
   109 CWin1258Implementation* CWin1258Implementation::NewL()
   110     {
   111     CWin1258Implementation* self = new(ELeave) CWin1258Implementation;
   112     return self;
   113     }
   114 
   115 CWin1258Implementation::CWin1258Implementation()
   116     {
   117     //default constructor.. do nothing
   118     }
   119 
   120 CWin1258Implementation::~CWin1258Implementation()
   121     {
   122     //default destructor .. do nothing
   123     }
   124 
   125 // ECOM CREATION FUNCTION
   126 const TImplementationProxy ImplementationTable[] = 
   127     {
   128     // Note: This is the same UID as defined in old mmp-file
   129     // Used also in 12221212.rss ( implementation_uid )
   130     IMPLEMENTATION_PROXY_ENTRY( 0x102073B8, CWin1258Implementation::NewL )
   131     };
   132 
   133 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
   134     {
   135     aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
   136     return ImplementationTable;
   137     }
   138