menufw/hierarchynavigator/hnutilities/src/hnmduidkey.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 "hnmduidkey.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // 
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CHnMdUidKey* CHnMdUidKey::NewL()
       
    30     {
       
    31     CHnMdUidKey* self = NewLC();
       
    32     CleanupStack::Pop( self );
       
    33     return self;
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // 
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 CHnMdUidKey* CHnMdUidKey::NewLC()
       
    41     {
       
    42     CHnMdUidKey* self = new ( ELeave ) CHnMdUidKey();
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL();
       
    45     return self;
       
    46     }
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // 
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CHnMdUidKey* CHnMdUidKey::NewL(const CHnMdUidKey* aKey)
       
    53     {
       
    54     CHnMdUidKey* self = NewLC(aKey);
       
    55     CleanupStack::Pop( self );
       
    56     return self;
       
    57     }
       
    58 
       
    59 // ---------------------------------------------------------------------------
       
    60 // 
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 CHnMdUidKey* CHnMdUidKey::NewLC( const CHnMdUidKey* aKey )
       
    64     {
       
    65     CHnMdUidKey* self = new ( ELeave ) CHnMdUidKey();
       
    66     CleanupStack::PushL( self );
       
    67     self->ConstructL( aKey );
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // 
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 CHnMdBaseKey* CHnMdUidKey::CopyLC()
       
    76     {
       
    77     CHnMdUidKey* self = CHnMdUidKey::NewL( this);
       
    78     CleanupStack::PushL( self );
       
    79     return self;
       
    80     }
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // 
       
    84 // ---------------------------------------------------------------------------
       
    85 //
       
    86 CHnMdUidKey::~CHnMdUidKey()
       
    87     {
       
    88     }
       
    89 
       
    90 // ---------------------------------------------------------------------------
       
    91 // 
       
    92 // ---------------------------------------------------------------------------
       
    93 //
       
    94 void CHnMdUidKey::GetKeyContent( TInt& aKeyContent ) const
       
    95     {
       
    96     // converts hexadecimal string into integer
       
    97     TLex lex( iContent );
       
    98     TUint a;
       
    99     lex.Inc( 2 );
       
   100     lex.Mark();
       
   101 
       
   102     TInt err = lex.Val( a, EHex );
       
   103 
       
   104     if ( err == KErrNone )
       
   105         {
       
   106         aKeyContent = a;
       
   107         }
       
   108     else
       
   109         {
       
   110         aKeyContent = err;
       
   111         }
       
   112     }
       
   113 
       
   114 // ---------------------------------------------------------------------------
       
   115 // 
       
   116 // ---------------------------------------------------------------------------
       
   117 //
       
   118 CHnMdUidKey::CHnMdUidKey()
       
   119     {
       
   120     }
       
   121 
       
   122 // ---------------------------------------------------------------------------
       
   123 // 
       
   124 // ---------------------------------------------------------------------------
       
   125 //
       
   126 void CHnMdUidKey::ConstructL()
       
   127     {
       
   128     }
       
   129 
       
   130 // ---------------------------------------------------------------------------
       
   131 // 
       
   132 // ---------------------------------------------------------------------------
       
   133 //
       
   134 void CHnMdUidKey::ConstructL( const CHnMdUidKey* aKey )
       
   135     {
       
   136     BaseConstructL( aKey );
       
   137     }
       
   138 
       
   139 // ---------------------------------------------------------------------------
       
   140 // 
       
   141 // ---------------------------------------------------------------------------
       
   142 //
       
   143 void CHnMdUidKey::ToVariantL( TLiwVariant& aRet ) const
       
   144     {
       
   145     TLiwVariant ret;
       
   146     TInt intVal( KErrGeneral );
       
   147     GetKeyContent( intVal );
       
   148     aRet.SetL( TLiwVariant( TUid::Uid( intVal ) ) ); // creates a copy of the data
       
   149     }
       
   150