contentstorage/cautils/src/cautils.cpp
changeset 60 f62f87b200ec
child 119 50e220be30d1
equal deleted inserted replaced
4:1a2a00e78665 60:f62f87b200ec
       
     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:  ?Description
       
    15  *
       
    16  */
       
    17 
       
    18 #include "cautils.h"
       
    19 _LIT(KHexPrefix, "0x");
       
    20 
       
    21 // ---------------------------------------------------------
       
    22 // MenuUtils::GetTUint
       
    23 // ---------------------------------------------------------
       
    24 //
       
    25 EXPORT_C TInt MenuUtils::GetTUint( const TDesC& aStr, TUint& aInt )
       
    26     {
       
    27     TInt position( aStr.Find( KHexPrefix ) );
       
    28     TPtrC string( aStr );
       
    29     TRadix radix( EDecimal );
       
    30     if( position == 0 )
       
    31         {
       
    32         // is hex
       
    33         radix = EHex;
       
    34         string.Set( aStr.Mid( KHexPrefix().Length() ) );
       
    35         }
       
    36 
       
    37     return TLex( string ).Val( aInt, radix );
       
    38     }
       
    39