|
1 /* |
|
2 * Copyright (c) 2002-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 #ifndef NUMBERCONVERSION_H_ |
|
20 #define NUMBERCONVERSION_H_ |
|
21 |
|
22 #include <e32std.h> |
|
23 |
|
24 |
|
25 class NumberConversion |
|
26 /** |
|
27 Functions for converting numbers between different numbers form different |
|
28 scripts. The scripts supported are those given in enum TDigitType. |
|
29 @publishedAll |
|
30 @released |
|
31 */ |
|
32 { |
|
33 public: |
|
34 enum TDigitMatchType |
|
35 { |
|
36 EMatchSingleTypeOnly, |
|
37 EMatchMultipleTypes |
|
38 }; |
|
39 |
|
40 IMPORT_C static TInt ConvertFirstNumber(const TDesC& aText, TInt& aLength, |
|
41 TDigitType& aDigitType, |
|
42 TDigitMatchType aDigitMatchType = EMatchMultipleTypes); |
|
43 |
|
44 IMPORT_C static TInt PositionAndTypeOfNextNumber(const TDesC& aText, |
|
45 TDigitType& aDigitType, TInt aStartFrom = 0); |
|
46 |
|
47 IMPORT_C static void FormatNumber(TDes& aText, TInt aNumber, |
|
48 TDigitType aDigitType); |
|
49 |
|
50 IMPORT_C static void FormatDigit(TDes& aText, TInt aNumber, TInt aLeadingZero, |
|
51 TDigitType aDigitType); |
|
52 |
|
53 IMPORT_C static void AppendFormatNumber(TDes& aText, TInt aNumber, |
|
54 TDigitType aDigitType); |
|
55 |
|
56 IMPORT_C static void ConvertDigits(TDes& aText, TDigitType aDigitType); |
|
57 |
|
58 IMPORT_C static TInt LengthOfFormattedNumber(TInt aNumber, |
|
59 TDigitType aDigitType); |
|
60 |
|
61 IMPORT_C static TInt LengthOfConvertedText(const TDesC& aText, |
|
62 TDigitType aDigitType); |
|
63 |
|
64 IMPORT_C static void Format(TDigitType aDigitType, |
|
65 TRefByValue<TDes> aFmt,...); |
|
66 |
|
67 IMPORT_C static TChar ConvertDigit(TChar& aDigit, TDigitType aDigitType); |
|
68 }; |
|
69 |
|
70 #endif |