resourcemgmt/hwresourcesmgr/server/inc/HWRMFmTxRdsTextConverter.h
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef HWRMFMTXRDSTEXTCONVERTER_H
       
    21 #define HWRMFMTXRDSTEXTCONVERTER_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <f32file.h>
       
    26 #include "HWRMFmTxData.h"
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 /** 
       
    31 * The conversion table supports the following Unicode latin ranges:
       
    32 *   Basic Latin 0000–007F
       
    33 *   Latin-1 Supplement 0080–00FF
       
    34 *   Latin Extended-A 0100–017F
       
    35 *   Latin Extended-B 0180–024F
       
    36 */
       
    37 const TInt KConvertFromTableLength = 0x250;
       
    38 
       
    39 // MACROS
       
    40 // None
       
    41 
       
    42 // DATA TYPES
       
    43 // None
       
    44 
       
    45 // FUNCTION PROTOTYPES
       
    46 // None
       
    47 
       
    48 // FORWARD DECLARATIONS
       
    49 // None
       
    50 
       
    51 // CLASS DECLARATION
       
    52 
       
    53 /**
       
    54 * Utility for converting between Unicode and RDS text
       
    55 * HWRM Common Data upkeeps the instance.
       
    56 */
       
    57 class CHWRMFmTxRdsTextConverter : public CBase
       
    58     {
       
    59     public: // Constructors and Destructor
       
    60     
       
    61         /**
       
    62         * Two-phased constructor.
       
    63         */
       
    64         static CHWRMFmTxRdsTextConverter* NewL();
       
    65         
       
    66         /**
       
    67         * Destructor.
       
    68         */
       
    69         virtual ~CHWRMFmTxRdsTextConverter();
       
    70         
       
    71     public: // New functions
       
    72     
       
    73 		/**
       
    74         * Converts from Unicode to RDS text
       
    75         */ 	
       
    76     	void ConvertFromUnicodeL(const TDesC& aInput, TDes8& aOutput);
       
    77 
       
    78 		/**
       
    79         * Returns the RDS character used, to replace 
       
    80         * unsupported Unicode characters.
       
    81         */ 	
       
    82 		inline TText8 UnsupportedCharReplacement() const;	
       
    83 
       
    84 		/**
       
    85         * Sets the RDS character used, to replace 
       
    86         * unsupported Unicode characters.
       
    87         */ 	    	
       
    88     	void SetUnsupportedCharReplacement(const TText8 aChar);
       
    89 
       
    90     private:
       
    91     
       
    92         /**
       
    93         * Helper for ConvertFromUnicodeL. Returns whether aChar is within RDS character range.
       
    94         */
       
    95 		TBool SupportedCharacter( TUint8 aChar );
       
    96     
       
    97         /**
       
    98         * C++ default constructor.
       
    99         */
       
   100         CHWRMFmTxRdsTextConverter();
       
   101 
       
   102         /**
       
   103         * By default Symbian 2nd phase constructor is private.
       
   104         */
       
   105         void ConstructL();       
       
   106 
       
   107     private:
       
   108 
       
   109 		// This symbol is used to replace unsupported Unicode characters
       
   110 		TText8 iUnsupportedCharReplacement;
       
   111 
       
   112 		// Conversion table
       
   113         RFs iFileServer;
       
   114         RFile iConvertFromUnicodeFile;
       
   115         TBuf8<KConvertFromTableLength> iConvertFromUnicodeTable;
       
   116     };
       
   117     
       
   118 #include "HWRMFmTxRdsTextConverter.inl"    
       
   119 
       
   120 #endif  // HWRMFMTXRDSTEXTCONVERTER_H
       
   121             
       
   122 // End of File