charconvfw/Charconvplugin/src/KOI8R.cpp
changeset 0 1fb32624e06b
child 16 56cd22a7a1cb
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     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 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <charconv.h>
       
    24 #include <convgeneratedcpp.h>
       
    25 #include <ecom/implementationproxy.h>
       
    26 #include <charactersetconverter.h>
       
    27 // New Interface class
       
    28 class CKOI8RImplementation : public CCharacterSetConverterPluginInterface
       
    29 {
       
    30     public:
       
    31         virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
       
    32 
       
    33         virtual TInt ConvertFromUnicode(
       
    34             CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
       
    35             const TDesC8& aReplacementForUnconvertibleUnicodeCharacters, 
       
    36             TDes8& aForeign, 
       
    37             const TDesC16& aUnicode, 
       
    38             CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters );
       
    39 
       
    40         virtual TInt ConvertToUnicode(
       
    41             CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters, 
       
    42             TDes16& aUnicode, 
       
    43             const TDesC8& aForeign, 
       
    44             TInt&, 
       
    45             TInt& aNumberOfUnconvertibleCharacters, 
       
    46             TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter );
       
    47 
       
    48         virtual TBool IsInThisCharacterSetL(
       
    49             TBool& aSetToTrue, 
       
    50             TInt& aConfidenceLevel, 
       
    51             const TDesC8& );
       
    52 
       
    53         static CKOI8RImplementation* NewL();
       
    54 
       
    55         virtual ~CKOI8RImplementation();
       
    56     private:
       
    57         CKOI8RImplementation();
       
    58 };
       
    59 
       
    60 const TDesC8& CKOI8RImplementation::ReplacementForUnconvertibleUnicodeCharacters()
       
    61 	{
       
    62     return ReplacementForUnconvertibleUnicodeCharacters_internal();
       
    63 	}
       
    64 
       
    65 TInt CKOI8RImplementation::ConvertFromUnicode(
       
    66          CCnvCharacterSetConverter::TEndianness 
       
    67          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 CKOI8RImplementation::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 
       
   100 TBool CKOI8RImplementation::IsInThisCharacterSetL(
       
   101          TBool& aSetToTrue, 
       
   102          TInt& aConfidenceLevel, 
       
   103          const TDesC8& )
       
   104 	{
       
   105     aSetToTrue = EFalse;
       
   106 	aConfidenceLevel = 0;
       
   107 	return EFalse;
       
   108 	}
       
   109 
       
   110 CKOI8RImplementation* CKOI8RImplementation::NewL()
       
   111     {
       
   112     CKOI8RImplementation* self = new(ELeave) CKOI8RImplementation;
       
   113     return self;
       
   114     }
       
   115 
       
   116 CKOI8RImplementation::CKOI8RImplementation()
       
   117     {
       
   118     //default constructor.. do nothing
       
   119     }
       
   120 
       
   121 CKOI8RImplementation::~CKOI8RImplementation()
       
   122     {
       
   123     //default destructor .. do nothing
       
   124     }
       
   125 
       
   126 // ECOM CREATION FUNCTION
       
   127 const TImplementationProxy ImplementationTable[] = 
       
   128     {
       
   129     // Note: This is the same UID as defined in old mmp-file
       
   130     // Used also in 12221212.rss ( implementation_uid )
       
   131     IMPLEMENTATION_PROXY_ENTRY( 0x101F8778, CKOI8RImplementation::NewL )
       
   132     };
       
   133 
       
   134 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
   135     {
       
   136     aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
       
   137     return ImplementationTable;
       
   138     }
       
   139