menufw/hierarchynavigator/hnutilities/src/hnmdinteger64key.cpp
changeset 0 f72a12da539e
equal deleted inserted replaced
-1:000000000000 0:f72a12da539e
       
     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 #include <liwservicehandler.h>
       
    20 
       
    21 #include "hnmdinteger64key.h"
       
    22 #include "hnglobals.h"
       
    23 
       
    24 
       
    25 // ======== MEMBER FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // 
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CHnMdInteger64Key* CHnMdInteger64Key::NewL()
       
    32     {
       
    33     CHnMdInteger64Key* self = NewLC();
       
    34     CleanupStack::Pop( self );
       
    35     return self;
       
    36     }
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // 
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 CHnMdInteger64Key* CHnMdInteger64Key::NewLC()
       
    43     {
       
    44     CHnMdInteger64Key* self = new ( ELeave ) CHnMdInteger64Key();
       
    45     CleanupStack::PushL( self );
       
    46     self->ConstructL();
       
    47     return self;
       
    48     }
       
    49 
       
    50 // ---------------------------------------------------------------------------
       
    51 // 
       
    52 // ---------------------------------------------------------------------------
       
    53 //
       
    54 CHnMdInteger64Key* CHnMdInteger64Key::NewL( const CHnMdInteger64Key* aKey )
       
    55     {
       
    56     CHnMdInteger64Key* self = NewLC( aKey );
       
    57     CleanupStack::Pop( self );
       
    58     return self;
       
    59     }
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // 
       
    63 // ---------------------------------------------------------------------------
       
    64 //
       
    65 CHnMdInteger64Key* CHnMdInteger64Key::NewLC( const CHnMdInteger64Key* aKey )
       
    66     {
       
    67     CHnMdInteger64Key* self = new ( ELeave ) CHnMdInteger64Key();
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL( aKey );
       
    70     return self;
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // From class CHnMdBaseKey
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 CHnMdBaseKey* CHnMdInteger64Key::CopyLC()
       
    78     {
       
    79     CHnMdInteger64Key* self = CHnMdInteger64Key::NewL( this );
       
    80     CleanupStack::PushL( self );
       
    81     return self;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------------------------
       
    85 // 
       
    86 // ---------------------------------------------------------------------------
       
    87 //
       
    88 CHnMdInteger64Key::~CHnMdInteger64Key()
       
    89     {
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------------------------
       
    93 // From class CHnMdBaseKey
       
    94 // converts decimal or hexadecimal string into integer 
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 void CHnMdInteger64Key::GetKeyContent( TInt64& aKeyContent ) const
       
    98     {
       
    99     TLex lex( iContent );
       
   100     TInt err( KErrNone );
       
   101     if ( !iContent.Find( KHexPrefix16 ) )
       
   102         {
       
   103         // hexadecimal
       
   104         TUint hex;
       
   105         lex.Inc( KHexPrefix16().Length() );
       
   106         lex.Mark();
       
   107         err = lex.Val( hex, EHex );
       
   108         aKeyContent = hex;
       
   109         }
       
   110     else
       
   111         {
       
   112         // decimal
       
   113         err = lex.Val( aKeyContent );
       
   114         }
       
   115 
       
   116     if ( err != KErrNone )
       
   117         {
       
   118         aKeyContent = err;
       
   119         }
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // 
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 CHnMdInteger64Key::CHnMdInteger64Key()
       
   127     {
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // 
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 void CHnMdInteger64Key::ConstructL()
       
   135     {
       
   136     }
       
   137 
       
   138 // ---------------------------------------------------------------------------
       
   139 // 
       
   140 // ---------------------------------------------------------------------------
       
   141 //
       
   142 void CHnMdInteger64Key::ConstructL( const CHnMdInteger64Key* aKey )
       
   143     {
       
   144     BaseConstructL( aKey );
       
   145     }
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // From class CHnMdBaseKey
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 void CHnMdInteger64Key::ToVariantL( TLiwVariant& aRet ) const
       
   152     {
       
   153     TInt64 decimalValue( KErrNotFound );
       
   154     GetKeyContent( decimalValue );
       
   155     aRet.SetL( TLiwVariant( ( TInt64 ) decimalValue ) );
       
   156     }
       
   157