ncdengine/engine/src/catalogscontextimpl.cpp
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Implementation of context-class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "catalogscontextimpl.h"
       
    20 #include "catalogsdebug.h"
       
    21 
       
    22 
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // Warning: default-constructor leaves iSecureId in a undefined state
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CCatalogsContextImpl::CCatalogsContextImpl( TUid aFamilyId, TSecureId aSecureId,
       
    32     TInt aInstanceId ) :
       
    33     iFamilyId( aFamilyId ),
       
    34     iSecureId( aSecureId ),
       
    35     iInstanceId( aInstanceId )
       
    36     {
       
    37     DLTRACEIN(("this-ptr: %x", this));
       
    38     }
       
    39 
       
    40 void CCatalogsContextImpl::ConstructL()
       
    41     {
       
    42     
       
    43     }
       
    44 
       
    45 CCatalogsContextImpl* CCatalogsContextImpl::NewL( TUid aFamilyId, TSecureId aSecureId,
       
    46     TInt aInstanceId )
       
    47     {
       
    48     CCatalogsContextImpl* self = CCatalogsContextImpl::NewLC( aFamilyId, aSecureId,
       
    49         aInstanceId );
       
    50     CleanupStack::Pop( self );
       
    51     return self;
       
    52     }
       
    53 
       
    54 CCatalogsContextImpl* CCatalogsContextImpl::NewLC( TUid aFamilyId, TSecureId aSecureId,
       
    55     TInt aInstanceId )
       
    56     {
       
    57     CCatalogsContextImpl* self = new( ELeave ) CCatalogsContextImpl( aFamilyId,
       
    58         aSecureId, aInstanceId );
       
    59     CleanupStack::PushL( self );
       
    60     self->ConstructL();
       
    61     return self;
       
    62     }
       
    63 
       
    64 CCatalogsContextImpl::~CCatalogsContextImpl()
       
    65     {
       
    66     DLTRACEIN(("this-ptr: %x", this));
       
    67     for( TInt i=0; i<iProviderData.Count(); i++ )
       
    68         {
       
    69         iProviderData[i].Close();
       
    70         }
       
    71     iProviderData.Close();
       
    72     }
       
    73 
       
    74 
       
    75 // ---------------------------------------------------------------------------
       
    76 // Function to store familyid
       
    77 // ---------------------------------------------------------------------------
       
    78 //
       
    79 void CCatalogsContextImpl::SetFamilyId( TUid aNewId )
       
    80     {
       
    81     DLTRACEIN(("%X",aNewId.iUid));
       
    82     iFamilyId = aNewId;
       
    83     }
       
    84 
       
    85 // ---------------------------------------------------------------------------
       
    86 // Function to store secure id
       
    87 // ---------------------------------------------------------------------------
       
    88 //
       
    89 void CCatalogsContextImpl::SetSecureId( TSecureId aNewId )
       
    90     {
       
    91     DLTRACEIN(("%X",aNewId.iId));
       
    92     iSecureId = aNewId;
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // From class MCatalogsContext.
       
    97 // Function that returns family id.
       
    98 // ---------------------------------------------------------------------------
       
    99 //
       
   100 TUid CCatalogsContextImpl::FamilyId() const
       
   101     {
       
   102     return iFamilyId;
       
   103     }
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // From class MCatalogsContext.
       
   107 // Function that returns secure id.
       
   108 // ---------------------------------------------------------------------------
       
   109 //
       
   110 TSecureId CCatalogsContextImpl::SecureId() const
       
   111     {
       
   112     return iSecureId;
       
   113     }
       
   114 
       
   115 // ---------------------------------------------------------------------------
       
   116 // From class MCatalogsContext.
       
   117 // Function that returns instance id.
       
   118 // ---------------------------------------------------------------------------
       
   119 //
       
   120 TInt CCatalogsContextImpl::InstanceId() const
       
   121     {
       
   122     return iInstanceId;
       
   123     }
       
   124 
       
   125 // ---------------------------------------------------------------------------
       
   126 // From class MCatalogsContext.
       
   127 // Function that returns provider specific data buffer handle.
       
   128 // ---------------------------------------------------------------------------
       
   129 //
       
   130 RBuf8& CCatalogsContextImpl::ProviderDataL( TInt aProviderIndex )
       
   131     {
       
   132     while( iProviderData.Count() <= aProviderIndex )
       
   133         {
       
   134         RBuf8 emptyBuf;
       
   135         iProviderData.AppendL( emptyBuf );
       
   136         }
       
   137         
       
   138     return iProviderData[ aProviderIndex ];
       
   139     }