contentstorage/cautils/src/cautils.cpp
author hgs
Mon, 24 May 2010 20:50:46 +0300
changeset 95 c739008478cc
parent 85 7feec50967db
child 119 50e220be30d1
permissions -rw-r--r--
201019_02
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
 * All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
 * Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
 * Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
 * Description:  ?Description
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
 *
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
 */
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#include "cautils.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
_LIT(KHexPrefix, "0x");
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
// ---------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
// MenuUtils::GetTUint
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
// ---------------------------------------------------------
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
//
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
EXPORT_C TInt MenuUtils::GetTUint( const TDesC& aStr, TUint& aInt )
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
    {
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
    TInt position( aStr.Find( KHexPrefix ) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
    TPtrC string( aStr );
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
    TRadix radix( EDecimal );
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
    if( position == 0 )
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
        {
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
        // is hex
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
        radix = EHex;
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
        string.Set( aStr.Mid( KHexPrefix().Length() ) );
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
        }
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
    return TLex( string ).Val( aInt, radix );
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
    }
7feec50967db 201003_02
hgs
parents:
diff changeset
    39