1 numberconversion.h |
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef NUMBERCONVERSION_H_ |
|
17 #define NUMBERCONVERSION_H_ |
|
18 |
|
19 #include <e32std.h> |
|
20 |
|
21 |
|
22 class NumberConversion |
|
23 /** |
|
24 Functions for converting numbers between different numbers form different |
|
25 scripts. The scripts supported are those given in enum TDigitType. |
|
26 @publishedAll |
|
27 @released |
|
28 */ |
|
29 { |
|
30 public: |
|
31 enum TDigitMatchType |
|
32 { |
|
33 EMatchSingleTypeOnly, |
|
34 EMatchMultipleTypes |
|
35 }; |
|
36 |
|
37 IMPORT_C static TInt ConvertFirstNumber(const TDesC& aText, TInt& aLength, |
|
38 TDigitType& aDigitType, |
|
39 TDigitMatchType aDigitMatchType = EMatchMultipleTypes); |
|
40 |
|
41 IMPORT_C static TInt PositionAndTypeOfNextNumber(const TDesC& aText, |
|
42 TDigitType& aDigitType, TInt aStartFrom = 0); |
|
43 |
|
44 IMPORT_C static void FormatNumber(TDes& aText, TInt aNumber, |
|
45 TDigitType aDigitType); |
|
46 |
|
47 IMPORT_C static void FormatDigit(TDes& aText, TInt aNumber, TInt aLeadingZero, |
|
48 TDigitType aDigitType); |
|
49 |
|
50 IMPORT_C static void AppendFormatNumber(TDes& aText, TInt aNumber, |
|
51 TDigitType aDigitType); |
|
52 |
|
53 IMPORT_C static void ConvertDigits(TDes& aText, TDigitType aDigitType); |
|
54 |
|
55 IMPORT_C static TInt LengthOfFormattedNumber(TInt aNumber, |
|
56 TDigitType aDigitType); |
|
57 |
|
58 IMPORT_C static TInt LengthOfConvertedText(const TDesC& aText, |
|
59 TDigitType aDigitType); |
|
60 |
|
61 IMPORT_C static void Format(TDigitType aDigitType, |
|
62 TRefByValue<TDes> aFmt,...); |
|
63 |
|
64 IMPORT_C static TChar ConvertDigit(TChar& aDigit, TDigitType aDigitType); |
|
65 }; |
|
66 |
|
67 #endif |