|
1 /* |
|
2 * Copyright (c) 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 #include "mcsmenuutils.h" |
|
20 |
|
21 _LIT(KHexPrefix, "0x"); |
|
22 |
|
23 // --------------------------------------------------------- |
|
24 // MenuUtils::GetTUint |
|
25 // --------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C TInt MenuUtils::GetTUint( const TDesC& aStr, TUint& aInt ) |
|
28 { |
|
29 TInt position( aStr.Find(KHexPrefix) ); |
|
30 TPtrC string( aStr ); |
|
31 TRadix radix( EDecimal ); |
|
32 if ( position == 0 ) |
|
33 { |
|
34 // is hex |
|
35 radix = EHex; |
|
36 string.Set( aStr.Mid( KHexPrefix().Length() ) ); |
|
37 } |
|
38 |
|
39 return TLex( string ).Val( aInt, radix ); |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------- |
|
43 // MenuUtils::SetTUint |
|
44 // --------------------------------------------------------- |
|
45 // |
|
46 EXPORT_C void MenuUtils::SetTUint( TDes& aStr, TUint aInt ) |
|
47 { |
|
48 // save in new version |
|
49 aStr.Zero(); |
|
50 aStr.Append( KHexPrefix ); |
|
51 aStr.AppendNum( aInt, EHex ); |
|
52 } |
|
53 |