os/textandloc/charconvfw/charconvplugins/src/plugins/KOI8R.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2002 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 CKOI8RImplementation : 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 CKOI8RImplementation* NewL();
    55 
    56         virtual ~CKOI8RImplementation();
    57     private:
    58         CKOI8RImplementation();
    59 };
    60 
    61 const TDesC8& CKOI8RImplementation::ReplacementForUnconvertibleUnicodeCharacters()
    62 	{
    63     return ReplacementForUnconvertibleUnicodeCharacters_internal();
    64 	}
    65 
    66 TInt CKOI8RImplementation::ConvertFromUnicode(
    67          CCnvCharacterSetConverter::TEndianness 
    68          aDefaultEndiannessOfForeignCharacters, 
    69          const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
    70          TDes8& aForeign, 
    71          const TDesC16& aUnicode, 
    72          CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters )
    73 	{
    74     return CCnvCharacterSetConverter::DoConvertFromUnicode(
    75                     conversionData, 
    76                     aDefaultEndiannessOfForeignCharacters, 
    77                     aReplacementForUnconvertibleUnicodeCharacters, 
    78                     aForeign, 
    79                     aUnicode, 
    80                     aIndicesOfUnconvertibleCharacters );
    81 	}
    82 
    83 TInt CKOI8RImplementation::ConvertToUnicode(
    84          CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
    85          TDes16& aUnicode, 
    86          const TDesC8& aForeign, 
    87          TInt&, 
    88          TInt& aNumberOfUnconvertibleCharacters, 
    89          TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter )
    90 	{
    91     return CCnvCharacterSetConverter::DoConvertToUnicode(
    92                     conversionData, 
    93                     aDefaultEndiannessOfForeignCharacters, 
    94                     aUnicode, 
    95                     aForeign, 
    96                     aNumberOfUnconvertibleCharacters, 
    97                     aIndexOfFirstByteOfFirstUnconvertibleCharacter );
    98 	}
    99 
   100 
   101 TBool CKOI8RImplementation::IsInThisCharacterSetL(
   102          TBool& aSetToTrue, 
   103          TInt& aConfidenceLevel, 
   104          const TDesC8& )
   105 	{
   106     aSetToTrue = EFalse;
   107 	aConfidenceLevel = 0;
   108 	return EFalse;
   109 	}
   110 
   111 CKOI8RImplementation* CKOI8RImplementation::NewL()
   112     {
   113     CKOI8RImplementation* self = new(ELeave) CKOI8RImplementation;
   114     return self;
   115     }
   116 
   117 CKOI8RImplementation::CKOI8RImplementation()
   118     {
   119     //default constructor.. do nothing
   120     }
   121 
   122 CKOI8RImplementation::~CKOI8RImplementation()
   123     {
   124     //default destructor .. do nothing
   125     }
   126 
   127 // ECOM CREATION FUNCTION
   128 const TImplementationProxy ImplementationTable[] = 
   129     {
   130     // Note: This is the same UID as defined in old mmp-file
   131     // Used also in 12221212.rss ( implementation_uid )
   132     IMPLEMENTATION_PROXY_ENTRY( 0x101F8778, CKOI8RImplementation::NewL )
   133     };
   134 
   135 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
   136     {
   137     aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
   138     return ImplementationTable;
   139     }
   140