os/textandloc/charconvfw/charconvplugins/src/shared/CnvPictographShared.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/charconvfw/charconvplugins/src/shared/CnvPictographShared.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,305 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:         This class is a utitlity class for conversion of Vodafone
    1.18 +*                pictograph.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +
    1.24 +
    1.25 +
    1.26 +
    1.27 +
    1.28 +
    1.29 +
    1.30 +
    1.31 +#ifndef CNVPICTOGRAPHSHARED_H
    1.32 +#define CNVPICTOGRAPHSHARED_H
    1.33 +
    1.34 +//  INCLUDES
    1.35 +#include <e32std.h>
    1.36 +#include <charconv.h>
    1.37 +#include <convutils.h>
    1.38 +#include "PictographObserver.h"
    1.39 +
    1.40 +
    1.41 +// CONSTANTS
    1.42 +// Count of Vodafone pictograph's pages
    1.43 +const TInt KCountOfPictoPages(6);
    1.44 +
    1.45 +
    1.46 +// CLASS DECLARATION
    1.47 +
    1.48 +/**
    1.49 +*  This class is a utitlity class for conversion of Vodafone pictograph.
    1.50 +*  The conversion data are in each CnvPctograph1 - 6 dll.
    1.51 +*  CnvPictographShared only to be used by ISO2022Jp.cpl, SHIFTJIS_SHARED.dll or
    1.52 +*  something. For example, when CCnvCharacterSetConverter::ConvertFromUnicode()
    1.53 +*  is called, and ConvertFromUnicode() of ISO2022Jp.cpl is called. After that,
    1.54 +*  ISO2022Jp.cpl sets some parameters for the conversion. At that time,
    1.55 +*  CnvPictographShared::SetCharacterSetsForPictograph() is called.
    1.56 +*  In a nut shell, CnvPictographShared is chaind from Japanese conversion
    1.57 +*  plug-ins.
    1.58 +*
    1.59 +*  @lib CnvPictograph1.dll
    1.60 +*  @lib CnvPictograph2.dll
    1.61 +*  @lib CnvPictograph3.dll
    1.62 +*  @lib CnvPictograph4.dll
    1.63 +*  @lib CnvPictograph5.dll
    1.64 +*  @lib CnvPictograph6.dll
    1.65 +*  @since 2.6
    1.66 +*/
    1.67 +class CnvPictographShared
    1.68 +    {
    1.69 +    public:
    1.70 +        /**
    1.71 +        * It sets parameters to SCharacterSet array.
    1.72 +        * It called in ConvertFromUnicode().
    1.73 +        * It makes possible that pictograph conversion is called from other
    1.74 +        * conversion plug-ins.
    1.75 +        * @since 2.6
    1.76 +        * @param aArrayOfCharacterSets The conversion table array
    1.77 +        */
    1.78 +        static void SetCharacterSetsForPictograph(
    1.79 +            RArray<CnvUtilities::SCharacterSet>& aArrayOfCharacterSets);
    1.80 +        /**
    1.81 +        * It sets parameters to SCharacterSet array.
    1.82 +        * It called in ConvertFromUnicode().
    1.83 +        * It makes possible that pictograph conversion is called from other
    1.84 +        * conversion plug-ins.
    1.85 +        * @since 2.6
    1.86 +        * @param aArrayOfCharacterSets The conversion table array
    1.87 +        * @param aOriginalCharset The character set
    1.88 +        */
    1.89 +        static void SetCharacterSetsForPictograph(
    1.90 +            RArray<CnvUtilities::SCharacterSet>& aArrayOfCharacterSets,
    1.91 +            TOriginalCharset aOriginalCharset);
    1.92 +        /**
    1.93 +        * It sets parameters to SMethod array.
    1.94 +        * It called in ConvertToUnicode().
    1.95 +        * It makes possible that pictograph conversion is called from other
    1.96 +        * conversion plug-ins.
    1.97 +        * @since 2.6
    1.98 +        * @param aArrayOfMethods The conversion table array
    1.99 +        * @param aOriginalCharset The character set
   1.100 +        */
   1.101 +        static void SetMethodsForPictograph(
   1.102 +            RArray<CnvUtilities::SMethod>& aArrayOfMethods,
   1.103 +            TOriginalCharset aOriginalCharset);
   1.104 +        /**
   1.105 +        * It sets parameters to SState array.
   1.106 +        * It called in ConvertToUnicode().
   1.107 +        * It makes possible that pictograph conversion is called from other
   1.108 +        * conversion plug-ins.
   1.109 +        * @since 2.6
   1.110 +        * @param aArrayOfMethods The conversion table array
   1.111 +        */
   1.112 +        static void SetStatesForPictograph(
   1.113 +            RArray<CnvUtilities::SState>& aArrayOfStates);
   1.114 +
   1.115 +    private:
   1.116 +        /**
   1.117 +        * It converts from an intermediate buffer to a pictograph code.
   1.118 +        * After that, it adds shift-in code(0x0F).
   1.119 +        * @since 2.6
   1.120 +        * @param aStartPositionInDescriptor The start postion for checking
   1.121 +        * @param aDescriptor The descripter has intermidiate buffer.
   1.122 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.123 +        *                                          that it's dropped out
   1.124 +        */
   1.125 +        static void ConvertToPictograph1InPlace(
   1.126 +            TInt aStartPositionInDescriptor,
   1.127 +            TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut);
   1.128 +        /**
   1.129 +        * It converts from an intermediate buffer to a pictograph code.
   1.130 +        * After that, it adds shift-in code(0x0F).
   1.131 +        * @since 2.6
   1.132 +        * @param aStartPositionInDescriptor The start postion for checking
   1.133 +        * @param aDescriptor The descripter has intermidiate buffer.
   1.134 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.135 +        *                                          that it's dropped out
   1.136 +        */
   1.137 +        static void ConvertToPictograph2InPlace(
   1.138 +            TInt aStartPositionInDescriptor,
   1.139 +            TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut);
   1.140 +        /**
   1.141 +        * It converts from an intermediate buffer to a pictograph code.
   1.142 +        * After that, it adds shift-in code(0x0F).
   1.143 +        * @since 2.6
   1.144 +        * @param aStartPositionInDescriptor The start postion for checking
   1.145 +        * @param aDescriptor The descripter has intermidiate buffer.
   1.146 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.147 +        *                                          that it's dropped out
   1.148 +        */
   1.149 +        static void ConvertToPictograph3InPlace(
   1.150 +            TInt aStartPositionInDescriptor,
   1.151 +            TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut);
   1.152 +        /**
   1.153 +        * It converts from an intermediate buffer to a pictograph code.
   1.154 +        * After that, it adds shift-in code(0x0F).
   1.155 +        * @since 2.6
   1.156 +        * @param aStartPositionInDescriptor The start postion for checking
   1.157 +        * @param aDescriptor The descripter has intermidiate buffer.
   1.158 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.159 +        *                                          that it's dropped out
   1.160 +        */
   1.161 +        static void ConvertToPictograph4InPlace(
   1.162 +            TInt aStartPositionInDescriptor,
   1.163 +            TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut);
   1.164 +        /**
   1.165 +        * It converts from an intermediate buffer to a pictograph code.
   1.166 +        * After that, it adds shift-in code(0x0F).
   1.167 +        * @since 2.6
   1.168 +        * @param aStartPositionInDescriptor The start postion for checking
   1.169 +        * @param aDescriptor The descripter has intermidiate buffer.
   1.170 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.171 +        *                                          that it's dropped out
   1.172 +        */
   1.173 +        static void ConvertToPictograph5InPlace(
   1.174 +            TInt aStartPositionInDescriptor,
   1.175 +            TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut);
   1.176 +        /**
   1.177 +        * It converts from an intermediate buffer to a pictograph code.
   1.178 +        * After that, it adds shift-in code(0x0F).
   1.179 +        * @since 2.6
   1.180 +        * @param aStartPositionInDescriptor The start postion for checking
   1.181 +        * @param aDescriptor The descripter has intermidiate buffer.
   1.182 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.183 +        *                                          that it's dropped out
   1.184 +        */
   1.185 +        static void ConvertToPictograph6InPlace(
   1.186 +            TInt aStartPositionInDescriptor,
   1.187 +            TDes8& aDescriptor, TInt& aNumberOfCharactersThatDroppedOut);
   1.188 +
   1.189 +        /**
   1.190 +        * It returns a number of bytes that the conversion to pictograph is
   1.191 +        * possible in the descriptor.
   1.192 +        * @since 2.6
   1.193 +        * @param aDescriptor A descriptor has any character code.
   1.194 +        * @return Number of bytes that the conversion is possible
   1.195 +        */
   1.196 +        static TInt NumberOfBytesAbleToConvertSJisDirectMap(const TDesC8& aDescriptor);
   1.197 +
   1.198 +        /**
   1.199 +        * It returns a number of bytes that the conversion to pictograph is
   1.200 +        * possible in the descriptor.
   1.201 +        * @since 2.6
   1.202 +        * @param aDescriptor A descriptor has any character code.
   1.203 +        * @return Number of bytes that the conversion is possible
   1.204 +        */
   1.205 +        static TInt NumberOfBytesAbleToConvertToEucJpDirectMap1(const TDesC8& aDescriptor);
   1.206 +
   1.207 +        /**
   1.208 +        * It returns a number of bytes that the conversion to pictograph is
   1.209 +        * possible in the descriptor.
   1.210 +        * @since 2.6
   1.211 +        * @param aDescriptor A descriptor has any character code.
   1.212 +        * @return Number of bytes that the conversion is possible
   1.213 +        */
   1.214 +        static TInt NumberOfBytesAbleToConvertToEucJpDirectMap2(const TDesC8& aDescriptor);
   1.215 +
   1.216 +        /**
   1.217 +        * It returns a number of bytes that the conversion to pictograph is
   1.218 +        * possible in the descriptor.
   1.219 +        * @since 2.6
   1.220 +        * @param aDescriptor A descriptor has any character code.
   1.221 +        * @return Number of bytes that the conversion is possible
   1.222 +        */
   1.223 +        static TInt NumberOfBytesAbleToConvertToPicto1(
   1.224 +            const TDesC8& aDescriptor);
   1.225 +        /**
   1.226 +        * It returns a number of bytes that the conversion to pictograph is
   1.227 +        * possible in the descriptor.
   1.228 +        * @since 2.6
   1.229 +        * @param aDescriptor A descriptor has any character code.
   1.230 +        * @return Number of bytes that the conversion is possible
   1.231 +        */
   1.232 +        static TInt NumberOfBytesAbleToConvertToPicto2(
   1.233 +            const TDesC8& aDescriptor);
   1.234 +        /**
   1.235 +        * It returns a number of bytes that the conversion to pictograph is
   1.236 +        * possible in the descriptor.
   1.237 +        * @since 2.6
   1.238 +        * @param aDescriptor A descriptor has any character code.
   1.239 +        * @return Number of bytes that the conversion is possible
   1.240 +        */
   1.241 +        static TInt NumberOfBytesAbleToConvertToPicto3(
   1.242 +            const TDesC8& aDescriptor);
   1.243 +        /**
   1.244 +        * It returns a number of bytes that the conversion to pictograph is
   1.245 +        * possible in the descriptor.
   1.246 +        * @since 2.6
   1.247 +        * @param aDescriptor A descriptor has any character code.
   1.248 +        * @return Number of bytes that the conversion is possible
   1.249 +        */
   1.250 +        static TInt NumberOfBytesAbleToConvertToPicto4(
   1.251 +            const TDesC8& aDescriptor);
   1.252 +        /**
   1.253 +        * It returns a number of bytes that the conversion to pictograph is
   1.254 +        * possible in the descriptor.
   1.255 +        * @since 2.6
   1.256 +        * @param aDescriptor A descriptor has any character code.
   1.257 +        * @return Number of bytes that the conversion is possible
   1.258 +        */
   1.259 +        static TInt NumberOfBytesAbleToConvertToPicto5(
   1.260 +            const TDesC8& aDescriptor);
   1.261 +        /**
   1.262 +        * It returns a number of bytes that the conversion to pictograph is
   1.263 +        * possible in the descriptor.
   1.264 +        * @since 2.6
   1.265 +        * @param aDescriptor A descriptor has any character code.
   1.266 +        * @return Number of bytes that the conversion is possible
   1.267 +        */
   1.268 +        static TInt NumberOfBytesAbleToConvertToPicto6(
   1.269 +            const TDesC8& aDescriptor);
   1.270 +        /**
   1.271 +        * It's a common function for checking the number of bytes that
   1.272 +        * the conversion to pictograph
   1.273 +        * @since 2.6
   1.274 +        * @param aDescriptor A descriptor has any character code.
   1.275 +        * @param aIntermidiateCode An intermidiate buffer
   1.276 +        * @return Number of bytes that the conversion is possible
   1.277 +        */
   1.278 +        static TInt NumberOfBytesAbleToConvertToPictograph(
   1.279 +            const TDesC8& aDescriptor, TInt aIntermidiateCode);
   1.280 +        /**
   1.281 +        * It converts the string which includes a pictograph's escape sequence
   1.282 +        * to unicode.
   1.283 +        * @since 2.6
   1.284 +        * @param aDescriptor It includes a pictograph's escape sequence
   1.285 +        */
   1.286 +        static void ConvertToPictographFromUnicode(TDes8& aDescriptor);
   1.287 +
   1.288 +        /**
   1.289 +        * It converts the string which has Unicode with pictograph to EUC-jp
   1.290 +        * with direct mapped pictograph
   1.291 +        * @since 2.6
   1.292 +        * @param aDescriptor It includes a pictograph's escape sequence
   1.293 +        */
   1.294 +        static void ConvertToPictographFromEucJpPackedInPlace(TDes8& aDescriptor);
   1.295 +        /**
   1.296 +        * It appends a shift-in code to the descriptor.
   1.297 +        * @since 2.6
   1.298 +        * @param aDescriptor It's append a shift-in code.
   1.299 +        * @param aNumberOfCharactersThatDroppedOut The number of characters
   1.300 +        *                                          that it's dropped out
   1.301 +        */
   1.302 +        static void AppendShiftIn(TDes8& aDescriptor,
   1.303 +            TInt& aNumberOfCharactersThatDroppedOut);
   1.304 +    };
   1.305 +
   1.306 +#endif // CNVPICTOGRAPHSHARED_H
   1.307 +
   1.308 +// End of File