charconvfw/Charconvplugin/src/EucJpDirectmap.CPP
changeset 0 1fb32624e06b
child 16 56cd22a7a1cb
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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:    This file is a source code file for a charconv plug-in.
       
    15 
       
    16 *                This plug-in supports EUC-JP with direct mapped pictograph.
       
    17 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 // INCLUDE FILES
       
    27 
       
    28 #include <e32std.h>
       
    29 
       
    30 #include <charconv.h>
       
    31 
       
    32 
       
    33 
       
    34 #ifndef EKA2
       
    35 
       
    36 #include <CONVPLUG.H>
       
    37 
       
    38 #else
       
    39 
       
    40 #include <convgeneratedcpp.h>
       
    41 
       
    42 #include <ecom/implementationproxy.h>
       
    43 
       
    44 #include "charactersetconverter.h"
       
    45 
       
    46 #endif // !EKA2
       
    47 
       
    48 
       
    49 
       
    50 #include <convutils.h>
       
    51 
       
    52 #include <jisx0201.h>
       
    53 
       
    54 #include <jisx0208.h>
       
    55 
       
    56 #include <jisx0212.h>
       
    57 
       
    58 #include <CnvShiftJisDirectmap.h>
       
    59 
       
    60 // LOCAL CONSTANTS AND MACROS
       
    61 
       
    62 const TUint KSingleShift2=0x8e;
       
    63 
       
    64 const TUint KSingleShift3=0x8f;
       
    65 
       
    66 const TUint KFirstByteRangeFirstBlockStart = 0xF5;
       
    67 
       
    68 const TUint KFirstByteRangeFirstBlockEnd = 0xFE;
       
    69 
       
    70 const TUint KSecondByteRangeSecondBlockStart = 0xA1;
       
    71 
       
    72 const TUint KSecondByteRangeSecondBlockEnd = 0xFE;
       
    73 
       
    74 const TUint KPictographStartFirstByte = 0xF0;
       
    75 
       
    76 const TUint KPictographStartSecondByte = 0x40;
       
    77 
       
    78 const TUint KEUCJPSecondBlockStart = 0xF5;
       
    79 
       
    80 const TUint KEUCJPBlockSize = 0x5D;
       
    81 
       
    82 const TUint KShiftJisTrailByteIllegal = 0x7F;
       
    83 
       
    84 
       
    85 
       
    86 // SecureID for Brower app
       
    87 
       
    88 const TUint32 KBrowserSecureId = 0x10008D39;
       
    89 
       
    90 // Define for converting from YenSign to BackSlash
       
    91 
       
    92 const TUint KCharacterCodeForYenSign = 0x00A5;
       
    93 
       
    94 const TUint KCharacterCodeForBackSlash = 0x005C;
       
    95 
       
    96 
       
    97 
       
    98 // fullwidth question mark
       
    99 
       
   100 _LIT8(KLit8EucJpPackedReplacementForUnconvertibleUnicodeCharacters, "\xa1\xa9");
       
   101 
       
   102 #if defined(_DEBUG)
       
   103 
       
   104 _LIT(KLitPanicText, "EucJpDirectmap");
       
   105 
       
   106 enum TPanic
       
   107 
       
   108     {
       
   109 
       
   110     EPanicNothingToConvert1=1,
       
   111 
       
   112     EPanicNothingToConvert2,
       
   113 
       
   114     EPanicNothingToConvert3,
       
   115 
       
   116     EPanicNothingToConvert4,
       
   117 
       
   118     EPanicNothingToConvert5,
       
   119 
       
   120     EPanicNothingToConvert6,
       
   121 
       
   122     EPanicOddNumberOfBytes1,
       
   123 
       
   124     EPanicOddNumberOfBytes2,
       
   125 
       
   126     EPanicOddNumberOfBytes3,
       
   127 
       
   128     EPanicOddNumberOfBytes4,
       
   129 
       
   130     EPanicOddNumberOfBytes5,
       
   131 
       
   132     EPanicOddNumberOfBytes6,
       
   133 
       
   134     EPanicBadHighBit1,
       
   135 
       
   136     EPanicBadHighBit2,
       
   137 
       
   138     EPanicBadHighBit3,
       
   139 
       
   140     EPanicBadHighBit4,
       
   141 
       
   142     EPanicBadHighBit5,
       
   143 
       
   144     EPanicBadHighBit6,
       
   145 
       
   146     EPanicBadHighBit7,
       
   147 
       
   148     EPanicBadPointers1,
       
   149 
       
   150     EPanicBadPointers2,
       
   151 
       
   152     EPanicBadPointers3,
       
   153 
       
   154     EPanicBadPointers4,
       
   155 
       
   156     EPanicBadPointers5,
       
   157 
       
   158     EPanicBadPointers6,
       
   159 
       
   160     EPanicBadPointers7,
       
   161 
       
   162     EPanicBadPointers8,
       
   163 
       
   164     EPanicBadPointers9,
       
   165 
       
   166     EPanicBadPointers10,
       
   167 
       
   168     EPanicBadPointers11,
       
   169 
       
   170     EPanicBadPointers12,
       
   171 
       
   172     EPanicBadPointers13,
       
   173 
       
   174     EPanicBadPointers14,
       
   175 
       
   176     EPanicBadPointers15,
       
   177 
       
   178     EPanicBadPointers16,
       
   179 
       
   180     EPanicBadPointers17,
       
   181 
       
   182     EPanicBadPointers18,
       
   183 
       
   184     EPanicBadPointers19,
       
   185 
       
   186     EPanicBadPointers20,
       
   187 
       
   188     EPanicBadPointers21,
       
   189 
       
   190     EPanicBadPointers22,
       
   191 
       
   192     EPanicBadPointers23,
       
   193 
       
   194     EPanicBadPointers24,
       
   195 
       
   196     EPanicBadPointers25,
       
   197 
       
   198     EPanicBadPointers26,
       
   199 
       
   200     EPanicBadPointers27,
       
   201 
       
   202     EPanicBadPointers28,
       
   203 
       
   204     EPanicBadPointers29,
       
   205 
       
   206     EPanicBadPointers30,
       
   207 
       
   208     EPanicBadPointers31,
       
   209 
       
   210     EPanicBadPointers32,
       
   211 
       
   212     EPanicBadPointers33,
       
   213 
       
   214     EPanicBadPointers34,
       
   215 
       
   216     EPanicBadPointers35,
       
   217 
       
   218     EPanicBadPointers36,
       
   219 
       
   220     EPanicBadCalculation1,
       
   221 
       
   222     EPanicBadCalculation2,
       
   223 
       
   224     EPanicNumberOfBytesIsNotMultipleOfThree1,
       
   225 
       
   226     EPanicNumberOfBytesIsNotMultipleOfThree2,
       
   227 
       
   228     EPanicSingleShift2Expected,
       
   229 
       
   230     EPanicSingleShift3Expected
       
   231 
       
   232     };
       
   233 
       
   234 
       
   235 
       
   236 LOCAL_C void Panic(TPanic aPanic)
       
   237 
       
   238     {
       
   239 
       
   240     User::Panic(KLitPanicText, aPanic);
       
   241 
       
   242     }
       
   243 
       
   244 #endif
       
   245 
       
   246 
       
   247 
       
   248 // -----------------------------------------------------------------------------
       
   249 
       
   250 // DummyConvertFromIntermediateBufferInPlace
       
   251 
       
   252 //
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 
       
   256 //
       
   257 
       
   258 LOCAL_C void DummyConvertFromIntermediateBufferInPlace(TInt, TDes8&,
       
   259 
       
   260         TInt& aNumberOfCharactersThatDroppedOut)
       
   261 
       
   262     {
       
   263 
       
   264     aNumberOfCharactersThatDroppedOut = 0;
       
   265 
       
   266     }
       
   267 
       
   268 
       
   269 
       
   270 // -----------------------------------------------------------------------------
       
   271 
       
   272 // ConvertFromJisX0208ToEucJpPackedInPlace
       
   273 
       
   274 // Converts from JIS code to EUC-JP
       
   275 
       
   276 // -----------------------------------------------------------------------------
       
   277 
       
   278 //
       
   279 
       
   280 LOCAL_C void ConvertFromJisX0208ToEucJpPackedInPlace(
       
   281 
       
   282         TInt aStartPositionInDescriptor, TDes8& aDescriptor,
       
   283 
       
   284         TInt& aNumberOfCharactersThatDroppedOut)
       
   285 
       
   286     {
       
   287 
       
   288     aNumberOfCharactersThatDroppedOut = 0;
       
   289 
       
   290     const TInt descriptorLength = aDescriptor.Length();
       
   291 
       
   292     __ASSERT_DEBUG(descriptorLength > aStartPositionInDescriptor,
       
   293 
       
   294         Panic(EPanicNothingToConvert1));
       
   295 
       
   296     __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 2 == 0,
       
   297 
       
   298         Panic(EPanicOddNumberOfBytes1));
       
   299 
       
   300     TUint8* pointerToCurrentByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
   301 
       
   302     const TUint8* const pointerToLastByte =
       
   303 
       
   304         pointerToCurrentByte + (descriptorLength - 1);
       
   305 
       
   306     pointerToCurrentByte += aStartPositionInDescriptor;
       
   307 
       
   308     FOREVER
       
   309 
       
   310         {
       
   311 
       
   312         const TUint currentByte = *pointerToCurrentByte;
       
   313 
       
   314         __ASSERT_DEBUG((currentByte & 0x80) == 0, Panic(EPanicBadHighBit1));
       
   315 
       
   316         *pointerToCurrentByte = STATIC_CAST(TUint8, currentByte | 0x80);
       
   317 
       
   318         __ASSERT_DEBUG(pointerToCurrentByte <= pointerToLastByte,
       
   319 
       
   320             Panic(EPanicBadPointers1));
       
   321 
       
   322         if (pointerToCurrentByte >= pointerToLastByte)
       
   323 
       
   324             {
       
   325 
       
   326             break;
       
   327 
       
   328             }
       
   329 
       
   330         ++pointerToCurrentByte;
       
   331 
       
   332         }
       
   333 
       
   334     }
       
   335 
       
   336 
       
   337 
       
   338 // -----------------------------------------------------------------------------
       
   339 
       
   340 // ConvertFromHalfWidthKatakana8ToEucJpPackedInPlace
       
   341 
       
   342 // Converts from half width Katakana code to EUC-JP
       
   343 
       
   344 // -----------------------------------------------------------------------------
       
   345 
       
   346 //
       
   347 
       
   348 LOCAL_C void ConvertFromHalfWidthKatakana8ToEucJpPackedInPlace(
       
   349 
       
   350         TInt aStartPositionInDescriptor, TDes8& aDescriptor,
       
   351 
       
   352         TInt& aNumberOfCharactersThatDroppedOut)
       
   353 
       
   354     {
       
   355 
       
   356     TInt descriptorLength = aDescriptor.Length();
       
   357 
       
   358     __ASSERT_DEBUG(descriptorLength > aStartPositionInDescriptor,
       
   359 
       
   360         Panic(EPanicNothingToConvert2));
       
   361 
       
   362     aNumberOfCharactersThatDroppedOut = Max(0, (descriptorLength -
       
   363 
       
   364         aStartPositionInDescriptor) - ((aDescriptor.MaxLength() -
       
   365 
       
   366         aStartPositionInDescriptor) / 2));
       
   367 
       
   368     descriptorLength -= aNumberOfCharactersThatDroppedOut;
       
   369 
       
   370     __ASSERT_DEBUG(descriptorLength >= aStartPositionInDescriptor,
       
   371 
       
   372         Panic(EPanicBadCalculation1));
       
   373 
       
   374     if (descriptorLength <= aStartPositionInDescriptor)
       
   375 
       
   376         {
       
   377 
       
   378         aDescriptor.SetLength(descriptorLength);
       
   379 
       
   380         }
       
   381 
       
   382     else
       
   383 
       
   384         {
       
   385 
       
   386         // pointerToTargetByte is initialized properly when descriptorLength
       
   387 
       
   388         // has been offset to the actual final length of aDescriptor
       
   389 
       
   390         TUint8* pointerToTargetByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
   391 
       
   392         const TUint8* const pointerToFirstByte =
       
   393 
       
   394             pointerToTargetByte + aStartPositionInDescriptor;
       
   395 
       
   396         const TUint8* pointerToSourceByte =
       
   397 
       
   398             pointerToTargetByte + (descriptorLength - 1);
       
   399 
       
   400         descriptorLength =
       
   401 
       
   402             ((descriptorLength - aStartPositionInDescriptor) * 2) +
       
   403 
       
   404             aStartPositionInDescriptor;
       
   405 
       
   406         __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 2 == 0,
       
   407 
       
   408             Panic(EPanicOddNumberOfBytes2));
       
   409 
       
   410         aDescriptor.SetLength(descriptorLength);
       
   411 
       
   412         // pointerToTargetByte is is initialized properly here
       
   413 
       
   414         pointerToTargetByte += descriptorLength - 1;
       
   415 
       
   416         FOREVER
       
   417 
       
   418             {
       
   419 
       
   420             *pointerToTargetByte = *pointerToSourceByte;
       
   421 
       
   422             __ASSERT_DEBUG(pointerToTargetByte>pointerToFirstByte,
       
   423 
       
   424                 Panic(EPanicBadPointers2));
       
   425 
       
   426             --pointerToTargetByte;
       
   427 
       
   428             *pointerToTargetByte = KSingleShift2;
       
   429 
       
   430             __ASSERT_DEBUG(pointerToTargetByte >= pointerToFirstByte,
       
   431 
       
   432                 Panic(EPanicBadPointers3));
       
   433 
       
   434             if (pointerToTargetByte <= pointerToFirstByte)
       
   435 
       
   436                 {
       
   437 
       
   438                 break;
       
   439 
       
   440                 }
       
   441 
       
   442             --pointerToTargetByte;
       
   443 
       
   444             __ASSERT_DEBUG(pointerToSourceByte > pointerToFirstByte,
       
   445 
       
   446                 Panic(EPanicBadPointers4));
       
   447 
       
   448             --pointerToSourceByte;
       
   449 
       
   450             }
       
   451 
       
   452         __ASSERT_DEBUG(pointerToTargetByte == pointerToFirstByte,
       
   453 
       
   454             Panic(EPanicBadPointers5));
       
   455 
       
   456         __ASSERT_DEBUG(pointerToSourceByte == pointerToFirstByte,
       
   457 
       
   458             Panic(EPanicBadPointers6));
       
   459 
       
   460         }
       
   461 
       
   462     }
       
   463 
       
   464 
       
   465 
       
   466 // -----------------------------------------------------------------------------
       
   467 
       
   468 // ConvertFromJisX0212ToEucJpPackedInPlace
       
   469 
       
   470 // Converts from JIS code to EUC-JP
       
   471 
       
   472 // -----------------------------------------------------------------------------
       
   473 
       
   474 //
       
   475 
       
   476 LOCAL_C void ConvertFromJisX0212ToEucJpPackedInPlace(
       
   477 
       
   478         TInt aStartPositionInDescriptor, TDes8& aDescriptor,
       
   479 
       
   480         TInt& aNumberOfCharactersThatDroppedOut)
       
   481 
       
   482     {
       
   483 
       
   484     TInt descriptorLength=aDescriptor.Length();
       
   485 
       
   486     __ASSERT_DEBUG(descriptorLength > aStartPositionInDescriptor,
       
   487 
       
   488         Panic(EPanicNothingToConvert3));
       
   489 
       
   490     __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 2 == 0,
       
   491 
       
   492         Panic(EPanicOddNumberOfBytes3));
       
   493 
       
   494     aNumberOfCharactersThatDroppedOut =
       
   495 
       
   496         Max(0, ((descriptorLength - aStartPositionInDescriptor) / 2) -
       
   497 
       
   498         ((aDescriptor.MaxLength() - aStartPositionInDescriptor) / 3));
       
   499 
       
   500     descriptorLength -= aNumberOfCharactersThatDroppedOut * 2;
       
   501 
       
   502     __ASSERT_DEBUG(descriptorLength >= aStartPositionInDescriptor,
       
   503 
       
   504         Panic(EPanicBadCalculation2));
       
   505 
       
   506     if (descriptorLength <= aStartPositionInDescriptor)
       
   507 
       
   508         {
       
   509 
       
   510         aDescriptor.SetLength(descriptorLength);
       
   511 
       
   512         }
       
   513 
       
   514     else
       
   515 
       
   516         {
       
   517 
       
   518         __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 2 == 0,
       
   519 
       
   520             Panic(EPanicOddNumberOfBytes4));
       
   521 
       
   522         // pointerToTargetByte is initialized properly when descriptorLength
       
   523 
       
   524         // has been offset to the actual final length of aDescriptor
       
   525 
       
   526         TUint8* pointerToTargetByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
   527 
       
   528         const TUint8* const pointerToFirstByte =
       
   529 
       
   530             pointerToTargetByte + aStartPositionInDescriptor;
       
   531 
       
   532         const TUint8* pointerToSourceByte =
       
   533 
       
   534             pointerToTargetByte + (descriptorLength - 1);
       
   535 
       
   536         descriptorLength = (((descriptorLength - aStartPositionInDescriptor)
       
   537 
       
   538             * 3) / 2) + aStartPositionInDescriptor;
       
   539 
       
   540         __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 3 ==0,
       
   541 
       
   542             Panic(EPanicNumberOfBytesIsNotMultipleOfThree1));
       
   543 
       
   544         aDescriptor.SetLength(descriptorLength);
       
   545 
       
   546         // pointerToTargetByte is is initialized properly here
       
   547 
       
   548         pointerToTargetByte += descriptorLength - 1;
       
   549 
       
   550         FOREVER
       
   551 
       
   552             {
       
   553 
       
   554             __ASSERT_DEBUG((*pointerToSourceByte & 0x80) == 0,
       
   555 
       
   556                 Panic(EPanicBadHighBit2));
       
   557 
       
   558             *pointerToTargetByte =
       
   559 
       
   560                 STATIC_CAST(TUint8, *pointerToSourceByte | 0x80);
       
   561 
       
   562             __ASSERT_DEBUG(pointerToTargetByte > pointerToFirstByte,
       
   563 
       
   564                 Panic(EPanicBadPointers7));
       
   565 
       
   566             --pointerToTargetByte;
       
   567 
       
   568             __ASSERT_DEBUG(pointerToSourceByte > pointerToFirstByte,
       
   569 
       
   570                 Panic(EPanicBadPointers8));
       
   571 
       
   572             --pointerToSourceByte;
       
   573 
       
   574             __ASSERT_DEBUG((*pointerToSourceByte & 0x80) == 0,
       
   575 
       
   576                 Panic(EPanicBadHighBit3));
       
   577 
       
   578             *pointerToTargetByte =
       
   579 
       
   580                 STATIC_CAST(TUint8, *pointerToSourceByte | 0x80);
       
   581 
       
   582             __ASSERT_DEBUG(pointerToTargetByte > pointerToFirstByte,
       
   583 
       
   584                 Panic(EPanicBadPointers9));
       
   585 
       
   586             --pointerToTargetByte;
       
   587 
       
   588             *pointerToTargetByte = KSingleShift3;
       
   589 
       
   590             __ASSERT_DEBUG(pointerToTargetByte >= pointerToFirstByte,
       
   591 
       
   592                 Panic(EPanicBadPointers10));
       
   593 
       
   594             if (pointerToTargetByte <= pointerToFirstByte)
       
   595 
       
   596                 {
       
   597 
       
   598                 break;
       
   599 
       
   600                 }
       
   601 
       
   602             --pointerToTargetByte;
       
   603 
       
   604             __ASSERT_DEBUG(pointerToSourceByte > pointerToFirstByte,
       
   605 
       
   606                 Panic(EPanicBadPointers11));
       
   607 
       
   608             --pointerToSourceByte;
       
   609 
       
   610             }
       
   611 
       
   612         __ASSERT_DEBUG(pointerToTargetByte == pointerToFirstByte,
       
   613 
       
   614             Panic(EPanicBadPointers12));
       
   615 
       
   616         __ASSERT_DEBUG(pointerToSourceByte == pointerToFirstByte,
       
   617 
       
   618             Panic(EPanicBadPointers13));
       
   619 
       
   620         }
       
   621 
       
   622     }
       
   623 
       
   624 
       
   625 
       
   626 // -----------------------------------------------------------------------------
       
   627 
       
   628 // NumberOfBytesAbleToConvertToJisRoman
       
   629 
       
   630 // Counts the bytes of be able to convert to JIS
       
   631 
       
   632 // -----------------------------------------------------------------------------
       
   633 
       
   634 //
       
   635 
       
   636 LOCAL_C TInt NumberOfBytesAbleToConvertToJisRoman(const TDesC8& aDescriptor)
       
   637 
       
   638     {
       
   639 
       
   640     const TUint8* pointerToPreviousByte = aDescriptor.Ptr() - 1;
       
   641 
       
   642     const TUint8* const pointerToLastByte =
       
   643 
       
   644         pointerToPreviousByte + aDescriptor.Length();
       
   645 
       
   646     if (pointerToPreviousByte == pointerToLastByte)
       
   647 
       
   648         {
       
   649 
       
   650         return 0;
       
   651 
       
   652         }
       
   653 
       
   654     FOREVER
       
   655 
       
   656         {
       
   657 
       
   658         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   659 
       
   660             Panic(EPanicBadPointers14));
       
   661 
       
   662         const TUint currentByte = *(pointerToPreviousByte + 1);
       
   663 
       
   664         if (currentByte & 0x80)
       
   665 
       
   666             {
       
   667 
       
   668             break;
       
   669 
       
   670             }
       
   671 
       
   672         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   673 
       
   674             Panic(EPanicBadPointers15));
       
   675 
       
   676         ++pointerToPreviousByte;
       
   677 
       
   678         __ASSERT_DEBUG(pointerToPreviousByte <= pointerToLastByte,
       
   679 
       
   680             Panic(EPanicBadPointers16));
       
   681 
       
   682         if (pointerToPreviousByte >= pointerToLastByte)
       
   683 
       
   684             {
       
   685 
       
   686             break;
       
   687 
       
   688             }
       
   689 
       
   690         }
       
   691 
       
   692     return (pointerToPreviousByte + 1) - aDescriptor.Ptr();
       
   693 
       
   694     }
       
   695 
       
   696 
       
   697 
       
   698 // -----------------------------------------------------------------------------
       
   699 
       
   700 // NumberOfBytesAbleToConvertToJisX0208
       
   701 
       
   702 // Counts the bytes of be able to convert to JIS
       
   703 
       
   704 // -----------------------------------------------------------------------------
       
   705 
       
   706 //
       
   707 
       
   708 LOCAL_C TInt NumberOfBytesAbleToConvertToJisX0208(const TDesC8& aDescriptor)
       
   709 
       
   710     {
       
   711 
       
   712     const TUint8* pointerToPreviousByte = aDescriptor.Ptr() - 1;
       
   713 
       
   714     const TUint8* const pointerToLastByte =
       
   715 
       
   716         pointerToPreviousByte + aDescriptor.Length();
       
   717 
       
   718     if (pointerToPreviousByte == pointerToLastByte)
       
   719 
       
   720         {
       
   721 
       
   722         return 0;
       
   723 
       
   724         }
       
   725 
       
   726     FOREVER
       
   727 
       
   728         {
       
   729 
       
   730         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   731 
       
   732             Panic(EPanicBadPointers17));
       
   733 
       
   734         TUint currentByte = *(pointerToPreviousByte + 1);
       
   735 
       
   736         if (currentByte < 0xa0)
       
   737 
       
   738             {
       
   739 
       
   740             break;
       
   741 
       
   742             }
       
   743 
       
   744         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   745 
       
   746             Panic(EPanicBadPointers18));
       
   747 
       
   748         if (pointerToLastByte - pointerToPreviousByte < 2)
       
   749 
       
   750             {
       
   751 
       
   752             break;
       
   753 
       
   754             }
       
   755 
       
   756         ++pointerToPreviousByte;
       
   757 
       
   758         currentByte = *(pointerToPreviousByte + 1);
       
   759 
       
   760         if (currentByte < 0xa0)
       
   761 
       
   762             {
       
   763 
       
   764             return CCnvCharacterSetConverter::EErrorIllFormedInput;
       
   765 
       
   766             }
       
   767 
       
   768         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   769 
       
   770             Panic(EPanicBadPointers19));
       
   771 
       
   772         ++pointerToPreviousByte;
       
   773 
       
   774         __ASSERT_DEBUG(pointerToPreviousByte <= pointerToLastByte,
       
   775 
       
   776             Panic(EPanicBadPointers20));
       
   777 
       
   778         if (pointerToPreviousByte >= pointerToLastByte)
       
   779 
       
   780             {
       
   781 
       
   782             break;
       
   783 
       
   784             }
       
   785 
       
   786         }
       
   787 
       
   788     return (pointerToPreviousByte + 1) - aDescriptor.Ptr();
       
   789 
       
   790     }
       
   791 
       
   792 
       
   793 
       
   794 // -----------------------------------------------------------------------------
       
   795 
       
   796 // NumberOfBytesAbleToConvertToHalfWidthKatakana8
       
   797 
       
   798 // Counts the bytes of be able to convert to half width Katakana
       
   799 
       
   800 // -----------------------------------------------------------------------------
       
   801 
       
   802 //
       
   803 
       
   804 LOCAL_C TInt NumberOfBytesAbleToConvertToHalfWidthKatakana8(const TDesC8& aDescriptor)
       
   805 
       
   806     {
       
   807 
       
   808     const TUint8* pointerToPreviousByte = aDescriptor.Ptr() - 1;
       
   809 
       
   810     const TUint8* const pointerToLastByte =
       
   811 
       
   812         pointerToPreviousByte + aDescriptor.Length();
       
   813 
       
   814     if (pointerToPreviousByte == pointerToLastByte)
       
   815 
       
   816         {
       
   817 
       
   818         return 0;
       
   819 
       
   820         }
       
   821 
       
   822     FOREVER
       
   823 
       
   824         {
       
   825 
       
   826         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   827 
       
   828             Panic(EPanicBadPointers21));
       
   829 
       
   830         TUint currentByte = *(pointerToPreviousByte + 1);
       
   831 
       
   832         if (currentByte != KSingleShift2)
       
   833 
       
   834             {
       
   835 
       
   836             break;
       
   837 
       
   838             }
       
   839 
       
   840         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   841 
       
   842             Panic(EPanicBadPointers22));
       
   843 
       
   844         if (pointerToLastByte - pointerToPreviousByte < 2)
       
   845 
       
   846             {
       
   847 
       
   848             break;
       
   849 
       
   850             }
       
   851 
       
   852         ++pointerToPreviousByte;
       
   853 
       
   854         currentByte = *(pointerToPreviousByte + 1);
       
   855 
       
   856         if (currentByte < 0xa0)
       
   857 
       
   858             {
       
   859 
       
   860             return CCnvCharacterSetConverter::EErrorIllFormedInput;
       
   861 
       
   862             }
       
   863 
       
   864         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   865 
       
   866             Panic(EPanicBadPointers23));
       
   867 
       
   868         ++pointerToPreviousByte;
       
   869 
       
   870         __ASSERT_DEBUG(pointerToPreviousByte <= pointerToLastByte,
       
   871 
       
   872             Panic(EPanicBadPointers24));
       
   873 
       
   874         if (pointerToPreviousByte >= pointerToLastByte)
       
   875 
       
   876             {
       
   877 
       
   878             break;
       
   879 
       
   880             }
       
   881 
       
   882         }
       
   883 
       
   884     return (pointerToPreviousByte + 1) - aDescriptor.Ptr();
       
   885 
       
   886     }
       
   887 
       
   888 
       
   889 
       
   890 // -----------------------------------------------------------------------------
       
   891 
       
   892 // NumberOfBytesAbleToConvertToJisX0212
       
   893 
       
   894 // Counts the bytes of be able to convert to JIS
       
   895 
       
   896 // -----------------------------------------------------------------------------
       
   897 
       
   898 //
       
   899 
       
   900 LOCAL_C TInt NumberOfBytesAbleToConvertToJisX0212(const TDesC8& aDescriptor)
       
   901 
       
   902     {
       
   903 
       
   904     const TUint8* pointerToPreviousByte = aDescriptor.Ptr() - 1;
       
   905 
       
   906     const TUint8* const pointerToLastByte =
       
   907 
       
   908         pointerToPreviousByte + aDescriptor.Length();
       
   909 
       
   910     if (pointerToPreviousByte == pointerToLastByte)
       
   911 
       
   912         {
       
   913 
       
   914         return 0;
       
   915 
       
   916         }
       
   917 
       
   918     FOREVER
       
   919 
       
   920         {
       
   921 
       
   922         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   923 
       
   924             Panic(EPanicBadPointers25));
       
   925 
       
   926         TUint currentByte = *(pointerToPreviousByte + 1);
       
   927 
       
   928         if (currentByte != KSingleShift3)
       
   929 
       
   930             {
       
   931 
       
   932             break;
       
   933 
       
   934             }
       
   935 
       
   936         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   937 
       
   938             Panic(EPanicBadPointers26));
       
   939 
       
   940         if (pointerToLastByte - pointerToPreviousByte < 3)
       
   941 
       
   942             {
       
   943 
       
   944             break;
       
   945 
       
   946             }
       
   947 
       
   948         ++pointerToPreviousByte;
       
   949 
       
   950         currentByte = *(pointerToPreviousByte + 1);
       
   951 
       
   952         if (currentByte < 0xa0)
       
   953 
       
   954             {
       
   955 
       
   956             return CCnvCharacterSetConverter::EErrorIllFormedInput;
       
   957 
       
   958             }
       
   959 
       
   960         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   961 
       
   962             Panic(EPanicBadPointers27));
       
   963 
       
   964         ++pointerToPreviousByte;
       
   965 
       
   966         currentByte = *(pointerToPreviousByte + 1);
       
   967 
       
   968         if (currentByte < 0xa0)
       
   969 
       
   970             {
       
   971 
       
   972             return CCnvCharacterSetConverter::EErrorIllFormedInput;
       
   973 
       
   974             }
       
   975 
       
   976         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
   977 
       
   978             Panic(EPanicBadPointers28));
       
   979 
       
   980         ++pointerToPreviousByte;
       
   981 
       
   982         __ASSERT_DEBUG(pointerToPreviousByte <= pointerToLastByte,
       
   983 
       
   984             Panic(EPanicBadPointers29));
       
   985 
       
   986         if (pointerToPreviousByte >= pointerToLastByte)
       
   987 
       
   988             {
       
   989 
       
   990             break;
       
   991 
       
   992             }
       
   993 
       
   994         }
       
   995 
       
   996     return (pointerToPreviousByte + 1) - aDescriptor.Ptr();
       
   997 
       
   998     }
       
   999 
       
  1000 
       
  1001 
       
  1002 // -----------------------------------------------------------------------------
       
  1003 
       
  1004 // DummyConvertToIntermediateBufferInPlace
       
  1005 
       
  1006 //
       
  1007 
       
  1008 // -----------------------------------------------------------------------------
       
  1009 
       
  1010 //
       
  1011 
       
  1012 LOCAL_C void DummyConvertToIntermediateBufferInPlace(TDes8&)
       
  1013 
       
  1014     {
       
  1015 
       
  1016     }
       
  1017 
       
  1018 
       
  1019 
       
  1020 // -----------------------------------------------------------------------------
       
  1021 
       
  1022 // ConvertToJisX0208FromEucJpPackedInPlace
       
  1023 
       
  1024 // Converts from EUC-JP to JIS code
       
  1025 
       
  1026 // -----------------------------------------------------------------------------
       
  1027 
       
  1028 //
       
  1029 
       
  1030 LOCAL_C void ConvertToJisX0208FromEucJpPackedInPlace(TDes8& aDescriptor)
       
  1031 
       
  1032     {
       
  1033 
       
  1034     const TInt descriptorLength = aDescriptor.Length();
       
  1035 
       
  1036     __ASSERT_DEBUG(descriptorLength > 0, Panic(EPanicNothingToConvert4));
       
  1037 
       
  1038     __ASSERT_DEBUG(descriptorLength % 2 == 0, Panic(EPanicOddNumberOfBytes5));
       
  1039 
       
  1040     TUint8* pointerToCurrentByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
  1041 
       
  1042     const TUint8* const pointerToLastByte =
       
  1043 
       
  1044         pointerToCurrentByte + (descriptorLength - 1);
       
  1045 
       
  1046     FOREVER
       
  1047 
       
  1048         {
       
  1049 
       
  1050         const TUint currentByte = *pointerToCurrentByte;
       
  1051 
       
  1052         __ASSERT_DEBUG(currentByte & 0x80, Panic(EPanicBadHighBit4));
       
  1053 
       
  1054         *pointerToCurrentByte = STATIC_CAST(TUint8, currentByte & ~0x80);
       
  1055 
       
  1056         __ASSERT_DEBUG(pointerToCurrentByte <= pointerToLastByte,
       
  1057 
       
  1058             Panic(EPanicBadPointers30));
       
  1059 
       
  1060         if (pointerToCurrentByte >= pointerToLastByte)
       
  1061 
       
  1062             {
       
  1063 
       
  1064             break;
       
  1065 
       
  1066             }
       
  1067 
       
  1068         ++pointerToCurrentByte;
       
  1069 
       
  1070         }
       
  1071 
       
  1072     }
       
  1073 
       
  1074 
       
  1075 
       
  1076 // -----------------------------------------------------------------------------
       
  1077 
       
  1078 // ConvertToHalfWidthKatakana8FromEucJpPackedInPlace
       
  1079 
       
  1080 // Converts from EUC-JP to half width Katakana
       
  1081 
       
  1082 // -----------------------------------------------------------------------------
       
  1083 
       
  1084 //
       
  1085 
       
  1086 LOCAL_C void ConvertToHalfWidthKatakana8FromEucJpPackedInPlace(
       
  1087 
       
  1088         TDes8& aDescriptor)
       
  1089 
       
  1090     {
       
  1091 
       
  1092     const TInt descriptorLength = aDescriptor.Length();
       
  1093 
       
  1094     __ASSERT_DEBUG(descriptorLength > 0, Panic(EPanicNothingToConvert5));
       
  1095 
       
  1096     __ASSERT_DEBUG(descriptorLength % 2 == 0, Panic(EPanicOddNumberOfBytes6));
       
  1097 
       
  1098     TUint8* pointerToTargetByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
  1099 
       
  1100     const TUint8* pointerToSourceByte = pointerToTargetByte;
       
  1101 
       
  1102     const TUint8* const pointerToLastByte = pointerToSourceByte +
       
  1103 
       
  1104         (descriptorLength - 1);
       
  1105 
       
  1106     FOREVER
       
  1107 
       
  1108         {
       
  1109 
       
  1110         __ASSERT_DEBUG(*pointerToSourceByte == KSingleShift2,
       
  1111 
       
  1112             Panic(EPanicSingleShift2Expected));
       
  1113 
       
  1114         __ASSERT_DEBUG(pointerToSourceByte < pointerToLastByte,
       
  1115 
       
  1116             Panic(EPanicBadPointers31));
       
  1117 
       
  1118         ++pointerToSourceByte;
       
  1119 
       
  1120         const TUint sourceByte = *pointerToSourceByte;
       
  1121 
       
  1122         __ASSERT_DEBUG(sourceByte & 0x80, Panic(EPanicBadHighBit5));
       
  1123 
       
  1124         *pointerToTargetByte = STATIC_CAST(TUint8, sourceByte);
       
  1125 
       
  1126         __ASSERT_DEBUG(pointerToSourceByte <= pointerToLastByte,
       
  1127 
       
  1128             Panic(EPanicBadPointers32));
       
  1129 
       
  1130         if (pointerToSourceByte >= pointerToLastByte)
       
  1131 
       
  1132             {
       
  1133 
       
  1134             break;
       
  1135 
       
  1136             }
       
  1137 
       
  1138         ++pointerToSourceByte;
       
  1139 
       
  1140         ++pointerToTargetByte;
       
  1141 
       
  1142         }
       
  1143 
       
  1144     aDescriptor.SetLength(descriptorLength / 2);
       
  1145 
       
  1146     }
       
  1147 
       
  1148 
       
  1149 
       
  1150 // -----------------------------------------------------------------------------
       
  1151 
       
  1152 // ConvertToJisX0212FromEucJpPackedInPlace
       
  1153 
       
  1154 // Converts from EUC-JP to JIS
       
  1155 
       
  1156 // -----------------------------------------------------------------------------
       
  1157 
       
  1158 //
       
  1159 
       
  1160 LOCAL_C void ConvertToJisX0212FromEucJpPackedInPlace(TDes8& aDescriptor)
       
  1161 
       
  1162     {
       
  1163 
       
  1164     const TInt descriptorLength = aDescriptor.Length();
       
  1165 
       
  1166     __ASSERT_DEBUG(descriptorLength > 0, Panic(EPanicNothingToConvert6));
       
  1167 
       
  1168     __ASSERT_DEBUG(descriptorLength % 3 == 0,
       
  1169 
       
  1170         Panic(EPanicNumberOfBytesIsNotMultipleOfThree2));
       
  1171 
       
  1172     TUint8* pointerToTargetByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
  1173 
       
  1174     const TUint8* pointerToSourceByte = pointerToTargetByte;
       
  1175 
       
  1176     const TUint8* const pointerToLastByte =
       
  1177 
       
  1178         pointerToSourceByte + (descriptorLength - 1);
       
  1179 
       
  1180     FOREVER
       
  1181 
       
  1182         {
       
  1183 
       
  1184         __ASSERT_DEBUG(*pointerToSourceByte == KSingleShift3,
       
  1185 
       
  1186             Panic(EPanicSingleShift3Expected));
       
  1187 
       
  1188         __ASSERT_DEBUG(pointerToSourceByte < pointerToLastByte,
       
  1189 
       
  1190             Panic(EPanicBadPointers33));
       
  1191 
       
  1192         ++pointerToSourceByte;
       
  1193 
       
  1194         TUint sourceByte = *pointerToSourceByte;
       
  1195 
       
  1196         __ASSERT_DEBUG(sourceByte & 0x80, Panic(EPanicBadHighBit6));
       
  1197 
       
  1198         *pointerToTargetByte = STATIC_CAST(TUint8, sourceByte & ~0x80);
       
  1199 
       
  1200         __ASSERT_DEBUG(pointerToSourceByte<pointerToLastByte,
       
  1201 
       
  1202             Panic(EPanicBadPointers34));
       
  1203 
       
  1204         ++pointerToSourceByte;
       
  1205 
       
  1206         sourceByte = *pointerToSourceByte;
       
  1207 
       
  1208         __ASSERT_DEBUG(sourceByte&0x80, Panic(EPanicBadHighBit7));
       
  1209 
       
  1210         __ASSERT_DEBUG(pointerToTargetByte < pointerToLastByte,
       
  1211 
       
  1212             Panic(EPanicBadPointers35));
       
  1213 
       
  1214         ++pointerToTargetByte;
       
  1215 
       
  1216         *pointerToTargetByte = STATIC_CAST(TUint8, sourceByte & ~0x80);
       
  1217 
       
  1218         __ASSERT_DEBUG(pointerToSourceByte <= pointerToLastByte,
       
  1219 
       
  1220             Panic(EPanicBadPointers36));
       
  1221 
       
  1222         if (pointerToSourceByte >= pointerToLastByte)
       
  1223 
       
  1224             {
       
  1225 
       
  1226             break;
       
  1227 
       
  1228             }
       
  1229 
       
  1230         ++pointerToSourceByte;
       
  1231 
       
  1232         ++pointerToTargetByte;
       
  1233 
       
  1234         }
       
  1235 
       
  1236     aDescriptor.SetLength((descriptorLength / 3) * 2);
       
  1237 
       
  1238     }
       
  1239 
       
  1240 
       
  1241 
       
  1242 // -----------------------------------------------------------------------------
       
  1243 
       
  1244 // NumberOfBytesAbleToConvertToPictograph
       
  1245 
       
  1246 //
       
  1247 
       
  1248 // -----------------------------------------------------------------------------
       
  1249 
       
  1250 //
       
  1251 
       
  1252 LOCAL_C TInt NumberOfBytesAbleToConvertToPictograph1(const TDesC8& aDescriptor)
       
  1253 
       
  1254     {
       
  1255 
       
  1256     const TUint8* pointerToPreviousByte = aDescriptor.Ptr() - 1;
       
  1257 
       
  1258     const TUint8* const pointerToLastByte =
       
  1259 
       
  1260         pointerToPreviousByte + aDescriptor.Length();
       
  1261 
       
  1262     if (pointerToPreviousByte == pointerToLastByte)
       
  1263 
       
  1264         {
       
  1265 
       
  1266         return 0;
       
  1267 
       
  1268         }
       
  1269 
       
  1270     for (;pointerToPreviousByte < pointerToLastByte;)
       
  1271 
       
  1272         {
       
  1273 
       
  1274         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
  1275 
       
  1276             Panic(EPanicBadPointers14));
       
  1277 
       
  1278         TUint currentByte = *(pointerToPreviousByte + 1);
       
  1279 
       
  1280         const TUint nextByte = *(pointerToPreviousByte + 2);
       
  1281 
       
  1282         if (((currentByte < KFirstByteRangeFirstBlockStart) ||
       
  1283 
       
  1284              (currentByte > KFirstByteRangeFirstBlockEnd)) ||
       
  1285 
       
  1286             ((nextByte < KSecondByteRangeSecondBlockStart) ||
       
  1287 
       
  1288              (nextByte > KSecondByteRangeSecondBlockEnd)))
       
  1289 
       
  1290             {
       
  1291 
       
  1292             break;
       
  1293 
       
  1294             }
       
  1295 
       
  1296         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
  1297 
       
  1298             Panic(EPanicBadPointers15));
       
  1299 
       
  1300         pointerToPreviousByte += 2;
       
  1301 
       
  1302         }
       
  1303 
       
  1304     return (pointerToPreviousByte + 1) - aDescriptor.Ptr();
       
  1305 
       
  1306     }
       
  1307 
       
  1308 
       
  1309 
       
  1310 // -----------------------------------------------------------------------------
       
  1311 
       
  1312 // NumberOfBytesAbleToConvertToPictograph
       
  1313 
       
  1314 //
       
  1315 
       
  1316 // -----------------------------------------------------------------------------
       
  1317 
       
  1318 //
       
  1319 
       
  1320 LOCAL_C TInt NumberOfBytesAbleToConvertToPictograph2(const TDesC8& aDescriptor)
       
  1321 
       
  1322     {
       
  1323 
       
  1324     const TUint8* pointerToPreviousByte = aDescriptor.Ptr() - 1;
       
  1325 
       
  1326     const TUint8* const pointerToLastByte =
       
  1327 
       
  1328         pointerToPreviousByte + aDescriptor.Length();
       
  1329 
       
  1330     if (pointerToPreviousByte == pointerToLastByte)
       
  1331 
       
  1332         {
       
  1333 
       
  1334         return 0;
       
  1335 
       
  1336         }
       
  1337 
       
  1338     for (;pointerToPreviousByte < pointerToLastByte;)
       
  1339 
       
  1340         {
       
  1341 
       
  1342         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
  1343 
       
  1344             Panic(EPanicBadPointers14));
       
  1345 
       
  1346         TUint currentByte = *(pointerToPreviousByte + 1);
       
  1347 
       
  1348         if (currentByte == KSingleShift3)
       
  1349 
       
  1350             {
       
  1351 
       
  1352             pointerToPreviousByte++;
       
  1353 
       
  1354             currentByte = *(pointerToPreviousByte + 1);
       
  1355 
       
  1356             }
       
  1357 
       
  1358         else
       
  1359 
       
  1360             {
       
  1361 
       
  1362             break;
       
  1363 
       
  1364             }
       
  1365 
       
  1366         if (currentByte < 0xa0)
       
  1367 
       
  1368             {
       
  1369 
       
  1370             return CCnvCharacterSetConverter::EErrorIllFormedInput;
       
  1371 
       
  1372             }
       
  1373 
       
  1374         const TUint nextByte = *(pointerToPreviousByte + 2);
       
  1375 
       
  1376         if (nextByte < 0xa0)
       
  1377 
       
  1378             {
       
  1379 
       
  1380             return CCnvCharacterSetConverter::EErrorIllFormedInput;
       
  1381 
       
  1382             }
       
  1383 
       
  1384         if (((currentByte < KFirstByteRangeFirstBlockStart) ||
       
  1385 
       
  1386              (currentByte > KFirstByteRangeFirstBlockEnd)) ||
       
  1387 
       
  1388             ((nextByte < KSecondByteRangeSecondBlockStart) ||
       
  1389 
       
  1390              (nextByte > KSecondByteRangeSecondBlockEnd)))
       
  1391 
       
  1392             {
       
  1393 
       
  1394             // return the previous byte to the beginning of loop.
       
  1395 
       
  1396             pointerToPreviousByte--;
       
  1397 
       
  1398             break;
       
  1399 
       
  1400             }
       
  1401 
       
  1402         __ASSERT_DEBUG(pointerToPreviousByte < pointerToLastByte,
       
  1403 
       
  1404             Panic(EPanicBadPointers15));
       
  1405 
       
  1406         pointerToPreviousByte += 2;
       
  1407 
       
  1408         }
       
  1409 
       
  1410     return (pointerToPreviousByte + 1) - aDescriptor.Ptr();
       
  1411 
       
  1412     }
       
  1413 
       
  1414 
       
  1415 
       
  1416 // -----------------------------------------------------------------------------
       
  1417 
       
  1418 // ConvertFromPictogaphToEucJpDirectmapInPlace
       
  1419 
       
  1420 // Converts from EucJp packed Pictograph to Unicode
       
  1421 
       
  1422 // -----------------------------------------------------------------------------
       
  1423 
       
  1424 //
       
  1425 
       
  1426 LOCAL_C void ConvertFromPictogaphToEucJpDirectmapInPlace(
       
  1427 
       
  1428         TInt aStartPositionInDescriptor, TDes8& aDescriptor,
       
  1429 
       
  1430         TInt& aNumberOfCharactersThatDroppedOut)
       
  1431 
       
  1432     {
       
  1433 
       
  1434     TInt descriptorLength=aDescriptor.Length();
       
  1435 
       
  1436     __ASSERT_DEBUG(descriptorLength > aStartPositionInDescriptor,
       
  1437 
       
  1438         Panic(EPanicNothingToConvert3));
       
  1439 
       
  1440     __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 2 == 0,
       
  1441 
       
  1442         Panic(EPanicOddNumberOfBytes3));
       
  1443 
       
  1444     TInt bytesPerCharacter = 2;
       
  1445 
       
  1446     if (aDescriptor[0] >= KEUCJPSecondBlockStart)
       
  1447 
       
  1448         {
       
  1449 
       
  1450         bytesPerCharacter = 3;
       
  1451 
       
  1452         }
       
  1453 
       
  1454 
       
  1455 
       
  1456     aNumberOfCharactersThatDroppedOut =
       
  1457 
       
  1458         Max(0, ((descriptorLength - aStartPositionInDescriptor) / 2) -
       
  1459 
       
  1460         ((aDescriptor.MaxLength() - aStartPositionInDescriptor) /
       
  1461 
       
  1462         bytesPerCharacter));
       
  1463 
       
  1464     descriptorLength -= aNumberOfCharactersThatDroppedOut * 2;
       
  1465 
       
  1466     __ASSERT_DEBUG(descriptorLength >= aStartPositionInDescriptor,
       
  1467 
       
  1468         Panic(EPanicBadCalculation2));
       
  1469 
       
  1470     if (descriptorLength <= aStartPositionInDescriptor)
       
  1471 
       
  1472         {
       
  1473 
       
  1474         aDescriptor.SetLength(descriptorLength);
       
  1475 
       
  1476         }
       
  1477 
       
  1478     else
       
  1479 
       
  1480         {
       
  1481 
       
  1482         __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) % 2 == 0,
       
  1483 
       
  1484             Panic(EPanicOddNumberOfBytes4));
       
  1485 
       
  1486         // pointerToTargetByte is initialized properly when descriptorLength
       
  1487 
       
  1488         // has been offset to the actual final length of aDescriptor
       
  1489 
       
  1490         TUint8* pointerToTargetByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
  1491 
       
  1492         const TUint8* const pointerToFirstByte =
       
  1493 
       
  1494             pointerToTargetByte + aStartPositionInDescriptor;
       
  1495 
       
  1496         const TUint8* pointerToSourceByte =
       
  1497 
       
  1498             pointerToTargetByte + (descriptorLength - 1);
       
  1499 
       
  1500         descriptorLength = (((descriptorLength - aStartPositionInDescriptor)
       
  1501 
       
  1502             * bytesPerCharacter) / 2) + aStartPositionInDescriptor;
       
  1503 
       
  1504         __ASSERT_DEBUG((descriptorLength - aStartPositionInDescriptor) %
       
  1505 
       
  1506             bytesPerCharacter == 0, Panic(EPanicNumberOfBytesIsNotMultipleOfThree1));
       
  1507 
       
  1508         aDescriptor.SetLength(descriptorLength);
       
  1509 
       
  1510         // pointerToTargetByte is is initialized properly here
       
  1511 
       
  1512         pointerToTargetByte += descriptorLength - 1;
       
  1513 
       
  1514         for (;pointerToTargetByte > pointerToFirstByte; )
       
  1515 
       
  1516             {
       
  1517 
       
  1518             TInt secondByte = *pointerToSourceByte;
       
  1519 
       
  1520             TInt firstByte = *(pointerToSourceByte - 1);
       
  1521 
       
  1522 
       
  1523 
       
  1524             if (bytesPerCharacter == 3)
       
  1525 
       
  1526                 {
       
  1527 
       
  1528                 firstByte = (firstByte - KEUCJPSecondBlockStart) * 2 +
       
  1529 
       
  1530                     KFirstByteRangeFirstBlockStart;
       
  1531 
       
  1532                 }
       
  1533 
       
  1534             else
       
  1535 
       
  1536                 {
       
  1537 
       
  1538                 firstByte = (firstByte - KPictographStartFirstByte) * 2 +
       
  1539 
       
  1540                     KFirstByteRangeFirstBlockStart;
       
  1541 
       
  1542                 }
       
  1543 
       
  1544             if (static_cast<TInt>(KEUCJPBlockSize + KPictographStartSecondByte + 1)
       
  1545 
       
  1546                  < secondByte)
       
  1547 
       
  1548                 {
       
  1549 
       
  1550                 if (secondByte > KShiftJisTrailByteIllegal)
       
  1551 
       
  1552                     secondByte -= 1;
       
  1553 
       
  1554                 secondByte = secondByte -(KPictographStartSecondByte +
       
  1555 
       
  1556                     KEUCJPBlockSize + 1) + KSecondByteRangeSecondBlockStart;
       
  1557 
       
  1558                 firstByte++;
       
  1559 
       
  1560                 }
       
  1561 
       
  1562             else
       
  1563 
       
  1564                 {
       
  1565 
       
  1566                 if (secondByte > KShiftJisTrailByteIllegal)
       
  1567 
       
  1568                     secondByte -= 1;
       
  1569 
       
  1570                 secondByte += KSecondByteRangeSecondBlockStart - KPictographStartSecondByte;
       
  1571 
       
  1572                 }
       
  1573 
       
  1574             *pointerToTargetByte = static_cast<TUint8>(secondByte);
       
  1575 
       
  1576             --pointerToTargetByte;
       
  1577 
       
  1578             *pointerToTargetByte = static_cast<TUint8>(firstByte);
       
  1579 
       
  1580             if (bytesPerCharacter == 3)
       
  1581 
       
  1582                 {
       
  1583 
       
  1584                 --pointerToTargetByte;
       
  1585 
       
  1586                 *pointerToTargetByte = KSingleShift3;
       
  1587 
       
  1588                 }
       
  1589 
       
  1590             __ASSERT_DEBUG(pointerToTargetByte >= pointerToFirstByte,
       
  1591 
       
  1592                 Panic(EPanicBadPointers10));
       
  1593 
       
  1594             --pointerToTargetByte;
       
  1595 
       
  1596             pointerToSourceByte -= 2;
       
  1597 
       
  1598             }
       
  1599 
       
  1600         }
       
  1601 
       
  1602     }
       
  1603 
       
  1604 
       
  1605 
       
  1606 // -----------------------------------------------------------------------------
       
  1607 
       
  1608 // ConvertToPictographFromEucJpPackedInPlace1
       
  1609 
       
  1610 // Converts from EucJp packed Pictograph to Unicode
       
  1611 
       
  1612 // -----------------------------------------------------------------------------
       
  1613 
       
  1614 //
       
  1615 
       
  1616 LOCAL_C void ConvertToPictographFromEucJpPackedInPlace(TDes8& aDescriptor)
       
  1617 
       
  1618     {
       
  1619 
       
  1620     const TInt descriptorLength = aDescriptor.Length();
       
  1621 
       
  1622     __ASSERT_DEBUG(descriptorLength > 0, Panic(EPanicNothingToConvert6));
       
  1623 
       
  1624     TUint8* pointerToTargetByte = CONST_CAST(TUint8*, aDescriptor.Ptr());
       
  1625 
       
  1626     const TUint8* pointerToSourceByte = pointerToTargetByte;
       
  1627 
       
  1628     const TUint8* const pointerToLastByte =
       
  1629 
       
  1630         pointerToSourceByte + (descriptorLength - 1);
       
  1631 
       
  1632     TInt bytesPerCharacter = 2;
       
  1633 
       
  1634     TInt sjisStartbyte = KPictographStartFirstByte;
       
  1635 
       
  1636     if (*pointerToSourceByte == KSingleShift3)
       
  1637 
       
  1638         {
       
  1639 
       
  1640         ++pointerToSourceByte;
       
  1641 
       
  1642         bytesPerCharacter = 3;
       
  1643 
       
  1644         sjisStartbyte = KEUCJPSecondBlockStart;
       
  1645 
       
  1646         }
       
  1647 
       
  1648     for (;pointerToSourceByte < pointerToLastByte; )
       
  1649 
       
  1650         {
       
  1651 
       
  1652         __ASSERT_DEBUG(pointerToSourceByte < pointerToLastByte,
       
  1653 
       
  1654             Panic(EPanicBadPointers33));
       
  1655 
       
  1656         TUint firstByte = (*pointerToSourceByte
       
  1657 
       
  1658             - KFirstByteRangeFirstBlockStart) / 2 + sjisStartbyte;
       
  1659 
       
  1660         TUint secondByte = *(pointerToSourceByte + 1);
       
  1661 
       
  1662         if ((*pointerToSourceByte % 2) == 0)
       
  1663 
       
  1664             {
       
  1665 
       
  1666             secondByte += KPictographStartSecondByte -
       
  1667 
       
  1668                 KSecondByteRangeSecondBlockStart + KEUCJPBlockSize + 1;
       
  1669 
       
  1670             if (secondByte >= KShiftJisTrailByteIllegal)
       
  1671 
       
  1672                 secondByte++;
       
  1673 
       
  1674             }
       
  1675 
       
  1676         else
       
  1677 
       
  1678             {
       
  1679 
       
  1680             secondByte += KPictographStartSecondByte - KSecondByteRangeSecondBlockStart;
       
  1681 
       
  1682             if (secondByte >= KShiftJisTrailByteIllegal)
       
  1683 
       
  1684                 secondByte++;
       
  1685 
       
  1686             }
       
  1687 
       
  1688         *pointerToTargetByte = static_cast<TUint8>(firstByte);
       
  1689 
       
  1690 
       
  1691 
       
  1692         __ASSERT_DEBUG(pointerToTargetByte < pointerToLastByte,
       
  1693 
       
  1694             Panic(EPanicBadPointers35));
       
  1695 
       
  1696         ++pointerToTargetByte;
       
  1697 
       
  1698         *pointerToTargetByte = static_cast<TUint8>(secondByte);
       
  1699 
       
  1700         __ASSERT_DEBUG(pointerToSourceByte <= pointerToLastByte,
       
  1701 
       
  1702             Panic(EPanicBadPointers36));
       
  1703 
       
  1704         pointerToSourceByte += 2;
       
  1705 
       
  1706         ++pointerToTargetByte;
       
  1707 
       
  1708         }
       
  1709 
       
  1710     aDescriptor.SetLength((descriptorLength / bytesPerCharacter) * 2);
       
  1711 
       
  1712     }
       
  1713 
       
  1714 
       
  1715 
       
  1716 // New Interface class
       
  1717 
       
  1718 class CEucJpDirectmapImplementation : public CCharacterSetConverterPluginInterface
       
  1719 
       
  1720 {
       
  1721 
       
  1722     public:
       
  1723 
       
  1724         virtual const TDesC8& ReplacementForUnconvertibleUnicodeCharacters();
       
  1725 
       
  1726 
       
  1727 
       
  1728         virtual TInt ConvertFromUnicode(
       
  1729 
       
  1730             CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
       
  1731 
       
  1732             const TDesC8& aReplacementForUnconvertibleUnicodeCharacters,
       
  1733 
       
  1734             TDes8& aForeign,
       
  1735 
       
  1736             const TDesC16& aUnicode,
       
  1737 
       
  1738             CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters );
       
  1739 
       
  1740 
       
  1741 
       
  1742         virtual TInt ConvertToUnicode(
       
  1743 
       
  1744             CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
       
  1745 
       
  1746             TDes16& aUnicode,
       
  1747 
       
  1748             const TDesC8& aForeign,
       
  1749 
       
  1750             TInt&,
       
  1751 
       
  1752             TInt& aNumberOfUnconvertibleCharacters,
       
  1753 
       
  1754             TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter );
       
  1755 
       
  1756 
       
  1757 
       
  1758         virtual TBool IsInThisCharacterSetL(
       
  1759 
       
  1760             TBool& aSetToTrue,
       
  1761 
       
  1762             TInt& aConfidenceLevel,
       
  1763 
       
  1764             const TDesC8& );
       
  1765 
       
  1766 
       
  1767 
       
  1768         static CEucJpDirectmapImplementation* NewL();
       
  1769 
       
  1770 
       
  1771 
       
  1772         virtual ~CEucJpDirectmapImplementation();
       
  1773 
       
  1774     private:
       
  1775 
       
  1776         CEucJpDirectmapImplementation();
       
  1777 
       
  1778 };
       
  1779 
       
  1780 
       
  1781 
       
  1782 // -----------------------------------------------------------------------------
       
  1783 
       
  1784 // ReplacementForUnconvertibleUnicodeCharacters
       
  1785 
       
  1786 // Retruns the character to replacement for unconvertible unicode character.
       
  1787 
       
  1788 // Returns: '?':
       
  1789 
       
  1790 // -----------------------------------------------------------------------------
       
  1791 
       
  1792 //
       
  1793 
       
  1794 const TDesC8& CEucJpDirectmapImplementation::ReplacementForUnconvertibleUnicodeCharacters()
       
  1795 
       
  1796     {
       
  1797 
       
  1798     return KLit8EucJpPackedReplacementForUnconvertibleUnicodeCharacters;
       
  1799 
       
  1800     }
       
  1801 
       
  1802 
       
  1803 
       
  1804 // -----------------------------------------------------------------------------
       
  1805 
       
  1806 // ConvertFromUnicode
       
  1807 
       
  1808 // Converts from Unicode to EUC-JP
       
  1809 
       
  1810 // Returns: The number of unconverted characters
       
  1811 
       
  1812 // -----------------------------------------------------------------------------
       
  1813 
       
  1814 //
       
  1815 
       
  1816 TInt CEucJpDirectmapImplementation::ConvertFromUnicode(
       
  1817 
       
  1818         CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
       
  1819 
       
  1820         const TDesC8& aReplacementForUnconvertibleUnicodeCharacters,
       
  1821 
       
  1822         TDes8& aForeign, const TDesC16& aUnicode,
       
  1823 
       
  1824         CCnvCharacterSetConverter::TArrayOfAscendingIndices& aIndicesOfUnconvertibleCharacters)
       
  1825 
       
  1826     {
       
  1827 
       
  1828     TFixedArray<CnvUtilities::SCharacterSet, 6> characterSets;
       
  1829 
       
  1830     characterSets[0].iConversionData = &CnvJisRoman::ConversionData();
       
  1831 
       
  1832     characterSets[0].iConvertFromIntermediateBufferInPlace =
       
  1833 
       
  1834         DummyConvertFromIntermediateBufferInPlace;
       
  1835 
       
  1836     characterSets[0].iEscapeSequence = &KNullDesC8;
       
  1837 
       
  1838     characterSets[1].iConversionData = &CnvJisX0208::ConversionData();
       
  1839 
       
  1840     characterSets[1].iConvertFromIntermediateBufferInPlace =
       
  1841 
       
  1842         ConvertFromJisX0208ToEucJpPackedInPlace;
       
  1843 
       
  1844     characterSets[1].iEscapeSequence = &KNullDesC8;
       
  1845 
       
  1846     characterSets[2].iConversionData = &CnvHalfWidthKatakana8::ConversionData();
       
  1847 
       
  1848     characterSets[2].iConvertFromIntermediateBufferInPlace =
       
  1849 
       
  1850         ConvertFromHalfWidthKatakana8ToEucJpPackedInPlace;
       
  1851 
       
  1852     characterSets[2].iEscapeSequence = &KNullDesC8;
       
  1853 
       
  1854     characterSets[3].iConversionData = &CnvJisX0212::ConversionData();
       
  1855 
       
  1856     characterSets[3].iConvertFromIntermediateBufferInPlace =
       
  1857 
       
  1858         ConvertFromJisX0212ToEucJpPackedInPlace;
       
  1859 
       
  1860     characterSets[3].iEscapeSequence = &KNullDesC8;
       
  1861 
       
  1862     characterSets[4].iConversionData = &CnvShiftJisDirectmap::ConversionData();
       
  1863 
       
  1864     characterSets[4].iConvertFromIntermediateBufferInPlace =
       
  1865 
       
  1866         ConvertFromPictogaphToEucJpDirectmapInPlace;
       
  1867 
       
  1868     characterSets[4].iEscapeSequence = &KNullDesC8;
       
  1869 
       
  1870     characterSets[5].iConversionData = &CnvShiftJisDirectmap::ConversionData();
       
  1871 
       
  1872     characterSets[5].iConvertFromIntermediateBufferInPlace =
       
  1873 
       
  1874         ConvertFromPictogaphToEucJpDirectmapInPlace;
       
  1875 
       
  1876     characterSets[5].iEscapeSequence = &KNullDesC8;
       
  1877 
       
  1878 
       
  1879 
       
  1880     TInt unconvert = CnvUtilities::ConvertFromUnicode(
       
  1881 
       
  1882         aDefaultEndiannessOfForeignCharacters,
       
  1883 
       
  1884         aReplacementForUnconvertibleUnicodeCharacters,
       
  1885 
       
  1886         aForeign, aUnicode, aIndicesOfUnconvertibleCharacters,
       
  1887 
       
  1888         characterSets.Array());
       
  1889 
       
  1890 
       
  1891 
       
  1892     return unconvert;
       
  1893 
       
  1894     }
       
  1895 
       
  1896 
       
  1897 
       
  1898 // -----------------------------------------------------------------------------
       
  1899 
       
  1900 // ConvertToUnicode
       
  1901 
       
  1902 // Converts from EUC-JP to Unicode.
       
  1903 
       
  1904 // Returns: The number of unconverted bytes
       
  1905 
       
  1906 // -----------------------------------------------------------------------------
       
  1907 
       
  1908 //
       
  1909 
       
  1910 TInt CEucJpDirectmapImplementation::ConvertToUnicode(
       
  1911 
       
  1912         CCnvCharacterSetConverter::TEndianness aDefaultEndiannessOfForeignCharacters,
       
  1913 
       
  1914         TDes16& aUnicode, const TDesC8& aForeign, TInt&,
       
  1915 
       
  1916         TInt& aNumberOfUnconvertibleCharacters,
       
  1917 
       
  1918         TInt& aIndexOfFirstByteOfFirstUnconvertibleCharacter)
       
  1919 
       
  1920     {
       
  1921 
       
  1922     TFixedArray<CnvUtilities::SMethod, 6> methods;
       
  1923 
       
  1924 
       
  1925 
       
  1926     methods[0].iNumberOfBytesAbleToConvert =
       
  1927 
       
  1928         NumberOfBytesAbleToConvertToPictograph1;
       
  1929 
       
  1930     methods[0].iConvertToIntermediateBufferInPlace =
       
  1931 
       
  1932         ConvertToPictographFromEucJpPackedInPlace;
       
  1933 
       
  1934     methods[0].iConversionData = &CnvShiftJisDirectmap::ConversionData();
       
  1935 
       
  1936     methods[0].iNumberOfBytesPerCharacter = 2;
       
  1937 
       
  1938     methods[0].iNumberOfCoreBytesPerCharacter = 2;
       
  1939 
       
  1940     methods[1].iNumberOfBytesAbleToConvert =
       
  1941 
       
  1942         NumberOfBytesAbleToConvertToPictograph2;
       
  1943 
       
  1944     methods[1].iConvertToIntermediateBufferInPlace =
       
  1945 
       
  1946         ConvertToPictographFromEucJpPackedInPlace;
       
  1947 
       
  1948     methods[1].iConversionData = &CnvShiftJisDirectmap::ConversionData();
       
  1949 
       
  1950     methods[1].iNumberOfBytesPerCharacter = 3;
       
  1951 
       
  1952     methods[1].iNumberOfCoreBytesPerCharacter = 2;
       
  1953 
       
  1954 
       
  1955 
       
  1956     methods[2].iNumberOfBytesAbleToConvert = NumberOfBytesAbleToConvertToJisRoman;
       
  1957 
       
  1958     methods[2].iConvertToIntermediateBufferInPlace =
       
  1959 
       
  1960         DummyConvertToIntermediateBufferInPlace;
       
  1961 
       
  1962     methods[2].iConversionData = &CnvJisRoman::ConversionData();
       
  1963 
       
  1964     methods[2].iNumberOfBytesPerCharacter = 1;
       
  1965 
       
  1966     methods[2].iNumberOfCoreBytesPerCharacter = 1;
       
  1967 
       
  1968     methods[3].iNumberOfBytesAbleToConvert = NumberOfBytesAbleToConvertToJisX0208;
       
  1969 
       
  1970     methods[3].iConvertToIntermediateBufferInPlace =
       
  1971 
       
  1972         ConvertToJisX0208FromEucJpPackedInPlace;
       
  1973 
       
  1974     methods[3].iConversionData = &CnvJisX0208::ConversionData();
       
  1975 
       
  1976     methods[3].iNumberOfBytesPerCharacter = 2;
       
  1977 
       
  1978     methods[3].iNumberOfCoreBytesPerCharacter = 2;
       
  1979 
       
  1980     methods[4].iNumberOfBytesAbleToConvert =
       
  1981 
       
  1982         NumberOfBytesAbleToConvertToHalfWidthKatakana8;
       
  1983 
       
  1984     methods[4].iConvertToIntermediateBufferInPlace =
       
  1985 
       
  1986         ConvertToHalfWidthKatakana8FromEucJpPackedInPlace;
       
  1987 
       
  1988     methods[4].iConversionData = &CnvHalfWidthKatakana8::ConversionData();
       
  1989 
       
  1990     methods[4].iNumberOfBytesPerCharacter = 2;
       
  1991 
       
  1992     methods[4].iNumberOfCoreBytesPerCharacter = 1;
       
  1993 
       
  1994     methods[5].iNumberOfBytesAbleToConvert =
       
  1995 
       
  1996         NumberOfBytesAbleToConvertToJisX0212;
       
  1997 
       
  1998     methods[5].iConvertToIntermediateBufferInPlace =
       
  1999 
       
  2000         ConvertToJisX0212FromEucJpPackedInPlace;
       
  2001 
       
  2002     methods[5].iConversionData = &CnvJisX0212::ConversionData();
       
  2003 
       
  2004     methods[5].iNumberOfBytesPerCharacter = 3;
       
  2005 
       
  2006     methods[5].iNumberOfCoreBytesPerCharacter = 2;
       
  2007 
       
  2008 
       
  2009 
       
  2010     TInt unconvert = CnvUtilities::ConvertToUnicodeFromHeterogeneousForeign(
       
  2011 
       
  2012         aDefaultEndiannessOfForeignCharacters, aUnicode, aForeign,
       
  2013 
       
  2014         aNumberOfUnconvertibleCharacters,
       
  2015 
       
  2016         aIndexOfFirstByteOfFirstUnconvertibleCharacter, methods.Array());
       
  2017 
       
  2018 
       
  2019 
       
  2020     // The following is specific impelementation for brower.
       
  2021 
       
  2022     // If brower app calls this API, the yen sign code(0xA5)
       
  2023 
       
  2024     // must be converted to backslash code(0x5C).
       
  2025 
       
  2026     // Becasue Javascript supports backslash code ony.
       
  2027 
       
  2028     TBool browserProcess = (RProcess().SecureId().iId == KBrowserSecureId);
       
  2029 
       
  2030     if (browserProcess && aUnicode.Length() > 0)
       
  2031 
       
  2032         {
       
  2033 
       
  2034         const TUint16* pB = aUnicode.Ptr();
       
  2035 
       
  2036         const TUint16* pbase = pB;
       
  2037 
       
  2038         const TUint16* pE = pB + aUnicode.Length() -1;
       
  2039 
       
  2040         while (pE>=pbase)
       
  2041 
       
  2042             {
       
  2043 
       
  2044             if (*pbase == KCharacterCodeForYenSign)
       
  2045 
       
  2046                 {
       
  2047 
       
  2048                 aUnicode[pbase - pB] = KCharacterCodeForBackSlash;
       
  2049 
       
  2050                 }
       
  2051 
       
  2052             pbase++;
       
  2053 
       
  2054             }
       
  2055 
       
  2056         }
       
  2057 
       
  2058 
       
  2059 
       
  2060     return unconvert;
       
  2061 
       
  2062     }
       
  2063 
       
  2064 
       
  2065 
       
  2066 // -----------------------------------------------------------------------------
       
  2067 
       
  2068 // IsInThisCharacterSetL
       
  2069 
       
  2070 // Detects whether the text is the character code or not.
       
  2071 
       
  2072 // Returns: ETrue:
       
  2073 
       
  2074 // -----------------------------------------------------------------------------
       
  2075 
       
  2076 //
       
  2077 
       
  2078 TBool CEucJpDirectmapImplementation::IsInThisCharacterSetL(TBool& /*aSetToTrue*/, TInt& /*aConfidenceLevel*/,
       
  2079 
       
  2080         const TDesC8& /*aSample*/)
       
  2081 
       
  2082     {
       
  2083 
       
  2084     return EFalse;
       
  2085 
       
  2086     }
       
  2087 
       
  2088 
       
  2089 
       
  2090 CEucJpDirectmapImplementation* CEucJpDirectmapImplementation::NewL()
       
  2091 
       
  2092     {
       
  2093 
       
  2094     CEucJpDirectmapImplementation* self = new(ELeave) CEucJpDirectmapImplementation;
       
  2095 
       
  2096     return self;
       
  2097 
       
  2098     }
       
  2099 
       
  2100 
       
  2101 
       
  2102 CEucJpDirectmapImplementation::CEucJpDirectmapImplementation()
       
  2103 
       
  2104     {
       
  2105 
       
  2106     //default constructor.. do nothing
       
  2107 
       
  2108     }
       
  2109 
       
  2110 
       
  2111 
       
  2112 CEucJpDirectmapImplementation::~CEucJpDirectmapImplementation()
       
  2113 
       
  2114     {
       
  2115 
       
  2116     //default destructor .. do nothing
       
  2117 
       
  2118     }
       
  2119 
       
  2120 
       
  2121 
       
  2122 // ECOM CREATION FUNCTION
       
  2123 
       
  2124 const TImplementationProxy ImplementationTable[] =
       
  2125 
       
  2126     {
       
  2127 
       
  2128     // Note: This is the same UID as defined in old mmp-file
       
  2129 
       
  2130     // Used also in 12221212.rss ( implementation_uid )
       
  2131 
       
  2132     IMPLEMENTATION_PROXY_ENTRY( 0x101F86A6, CEucJpDirectmapImplementation::NewL )
       
  2133 
       
  2134     };
       
  2135 
       
  2136 
       
  2137 
       
  2138 EXPORT_C const TImplementationProxy* ImplementationGroupProxy( TInt& aTableCount )
       
  2139 
       
  2140     {
       
  2141 
       
  2142     aTableCount = sizeof( ImplementationTable ) / sizeof(TImplementationProxy);
       
  2143 
       
  2144     return ImplementationTable;
       
  2145 
       
  2146     }
       
  2147 
       
  2148 
       
  2149 
       
  2150 // End of file
       
  2151