|
1 /* |
|
2 * Copyright (c) 2007-2008 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 HNCONVUTILS_H |
|
21 #define HNCONVUTILS_H |
|
22 |
|
23 #include <e32base.h> |
|
24 |
|
25 /** |
|
26 * Provides static methods for converting numbers to |
|
27 * descriptors and vice versa. |
|
28 * |
|
29 * @lib hnutilities.lib |
|
30 * @since S60 v5.0 |
|
31 * @ingroup group_hnutilities |
|
32 */ |
|
33 NONSHARABLE_CLASS( HnConvUtils ) |
|
34 { |
|
35 public: |
|
36 |
|
37 /** |
|
38 * Converts narrow string descriptor to default width string descriptor. |
|
39 * |
|
40 * @since S60 v5.0 |
|
41 * @param aStr Narrow string descriptor. |
|
42 * @return Default wide string descriptor. |
|
43 */ |
|
44 IMPORT_C static HBufC* Str8ToStr( const TDesC8& aStr ); |
|
45 |
|
46 /** |
|
47 * Converts narrow string descriptor to default width string descriptor. |
|
48 * Does not handle special characters. |
|
49 * |
|
50 * @since S60 v5.0 |
|
51 * @param aStr Narrow string descriptor. |
|
52 * @return Default wide string descriptor. |
|
53 */ |
|
54 static HBufC* Str8ToStrFastLC( const TDesC8& aStr ); |
|
55 |
|
56 /** |
|
57 * Converts wide string descriptor to narrow string descriptor. |
|
58 * Does not handle special characters. |
|
59 * |
|
60 * @since S60 v5.0 |
|
61 * @param aStr Wide string descriptor input. |
|
62 * @return Narrow string. |
|
63 */ |
|
64 static HBufC8* StrToStr8FastLC( const TDesC16& aStr ); |
|
65 |
|
66 /** |
|
67 * Converts narrow string descriptor to default width string descriptor. |
|
68 * Handles special characters. |
|
69 * |
|
70 * @since S60 v5.0 |
|
71 * @param aStr Narrow string descriptor. |
|
72 * @return Default wide string descriptor. |
|
73 */ |
|
74 IMPORT_C static HBufC* Str8ToStrLC( const TDesC8& aStr ); |
|
75 |
|
76 /** |
|
77 * Converts wide string descriptor to narrow string descriptor. |
|
78 * Handles special characters. |
|
79 * |
|
80 * @since S60 v5.0 |
|
81 * @param aStr Wide string descriptor input. |
|
82 * @return Narrow string. |
|
83 */ |
|
84 IMPORT_C static HBufC8* StrToStr8LC( const TDesC16& aStr ); |
|
85 |
|
86 /** |
|
87 * Converts wide string descriptor to narrow string descriptor. |
|
88 * |
|
89 * @since S60 v5.0 |
|
90 * @param aStr Wide string descriptor input. |
|
91 * @return Narrow string. |
|
92 */ |
|
93 IMPORT_C static HBufC8* StrToStr8L( const TDesC16& aStr ); |
|
94 |
|
95 /** |
|
96 * Converts integer to narrow string descriptor. |
|
97 * |
|
98 * @since S60 v5.0 |
|
99 * @param aNum Number. |
|
100 * @return Narrow string. |
|
101 */ |
|
102 IMPORT_C static HBufC8* NumToStr8LC( const TInt& aNum ); |
|
103 |
|
104 /** |
|
105 * Converts narrow string descriptor to integer value. |
|
106 * |
|
107 * @since S60 v5.0 |
|
108 * @param aValue Input descriptor. |
|
109 * @param aResult Result integer. |
|
110 * @return Error code. |
|
111 */ |
|
112 IMPORT_C static TInt Str8ToInt( const TDesC8& aValue, TInt& aResult ); |
|
113 |
|
114 /** |
|
115 * Converts string descriptor to integer value. |
|
116 * |
|
117 * @since S60 v5.0 |
|
118 * @param aValue Input descriptor. |
|
119 * @param aResult Result integer. |
|
120 * @return Error code. |
|
121 */ |
|
122 IMPORT_C static TInt StrToInt( const TDesC& aValue, TInt& aResult ); |
|
123 |
|
124 /** |
|
125 * Converts narrow string descriptor to integer value. |
|
126 * |
|
127 * @since S60 v5.0 |
|
128 * @param aValue Input descriptor. |
|
129 * @param aResult Result integer. |
|
130 * @return Error code. |
|
131 */ |
|
132 IMPORT_C static TInt Str8ToInt( const TDesC8& aValue, TInt32& aResult ); |
|
133 |
|
134 /** |
|
135 * Converts narrow string descriptor to integer value. |
|
136 * |
|
137 * @since S60 v5.0 |
|
138 * @param aValue Input descriptor. |
|
139 * @param aResult Result integer. |
|
140 * @return Error code. |
|
141 */ |
|
142 IMPORT_C static TInt StrToInt( const TDesC& aValue, TInt32& aResult ); |
|
143 |
|
144 /** |
|
145 * Converts narrow string descriptor to integer value. |
|
146 * |
|
147 * @since S60 v5.0 |
|
148 * @param aValue Input descriptor. |
|
149 * @param aResult Result integer. |
|
150 * @return Error code. |
|
151 */ |
|
152 IMPORT_C static TInt Str8ToUint( const TDesC8& aValue, TUint& aResult ); |
|
153 }; |
|
154 |
|
155 #include "hnconvutils.inl" |
|
156 |
|
157 #endif // HNCONVUTILS_H |
|
158 |