williamr@4: /* williamr@4: * Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: williamr@4: * williamr@4: */ williamr@4: williamr@2: williamr@2: #ifndef NUMBERCONVERSION_H_ williamr@2: #define NUMBERCONVERSION_H_ williamr@2: williamr@2: #include williamr@2: williamr@2: williamr@2: class NumberConversion williamr@2: /** williamr@2: Functions for converting numbers between different numbers form different williamr@2: scripts. The scripts supported are those given in enum TDigitType. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: enum TDigitMatchType williamr@2: { williamr@2: EMatchSingleTypeOnly, williamr@2: EMatchMultipleTypes williamr@2: }; williamr@2: williamr@2: IMPORT_C static TInt ConvertFirstNumber(const TDesC& aText, TInt& aLength, williamr@2: TDigitType& aDigitType, williamr@2: TDigitMatchType aDigitMatchType = EMatchMultipleTypes); williamr@2: williamr@2: IMPORT_C static TInt PositionAndTypeOfNextNumber(const TDesC& aText, williamr@2: TDigitType& aDigitType, TInt aStartFrom = 0); williamr@2: williamr@2: IMPORT_C static void FormatNumber(TDes& aText, TInt aNumber, williamr@2: TDigitType aDigitType); williamr@2: williamr@2: IMPORT_C static void FormatDigit(TDes& aText, TInt aNumber, TInt aLeadingZero, williamr@2: TDigitType aDigitType); williamr@2: williamr@2: IMPORT_C static void AppendFormatNumber(TDes& aText, TInt aNumber, williamr@2: TDigitType aDigitType); williamr@2: williamr@2: IMPORT_C static void ConvertDigits(TDes& aText, TDigitType aDigitType); williamr@2: williamr@2: IMPORT_C static TInt LengthOfFormattedNumber(TInt aNumber, williamr@2: TDigitType aDigitType); williamr@2: williamr@2: IMPORT_C static TInt LengthOfConvertedText(const TDesC& aText, williamr@2: TDigitType aDigitType); williamr@2: williamr@2: IMPORT_C static void Format(TDigitType aDigitType, williamr@2: TRefByValue aFmt,...); williamr@2: williamr@2: IMPORT_C static TChar ConvertDigit(TChar& aDigit, TDigitType aDigitType); williamr@2: }; williamr@2: williamr@2: #endif