lowlevellibsandfws/pluginfw/Framework/frame/RomOnlyResolver.cpp
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implements the CRomOnlyResolver class.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @internalComponent
       
    20  @file
       
    21 */
       
    22 
       
    23 #include <ecom/ecom.h>
       
    24 #include <ecom/ecomerrorcodes.h>
       
    25 #include <ecom/ecomresolverparams.h>
       
    26 #include <ecom/implementationinformation.h>
       
    27 
       
    28 #include "TestUtilities.h"	// For __FILE__LINE__
       
    29 #include "RomOnlyResolver.h"
       
    30 
       
    31 CRomOnlyResolver* CRomOnlyResolver::NewL(MPublicRegistry& aRegistry)
       
    32 	{
       
    33 	return new(ELeave) CRomOnlyResolver(aRegistry);
       
    34 	}
       
    35 
       
    36 CRomOnlyResolver::~CRomOnlyResolver()
       
    37 	{
       
    38 	}
       
    39 
       
    40 CRomOnlyResolver::CRomOnlyResolver(MPublicRegistry& aRegistry)
       
    41 : CDefaultResolver(aRegistry)
       
    42 	{
       
    43 	// Do nothing here
       
    44 	}
       
    45 
       
    46 TUid CRomOnlyResolver::IdentifyImplementationL(TUid aInterfaceUid, 
       
    47 											   const TEComResolverParams& aAdditionalParameters) const
       
    48 	{
       
    49 	RImplInfoArray* implementationsInfo = ListAllL(aInterfaceUid, aAdditionalParameters);
       
    50 	TUid found = KNullUid;
       
    51 	if(implementationsInfo->Count())
       
    52 		{
       
    53 		found = Resolve(*implementationsInfo, aAdditionalParameters);
       
    54 		}
       
    55 	implementationsInfo->Reset();
       
    56 	delete implementationsInfo;
       
    57 	return found;
       
    58 	}
       
    59 
       
    60 RImplInfoArray* CRomOnlyResolver::ListAllL(TUid aInterfaceUid, 
       
    61 										   const TEComResolverParams& aAdditionalParameters) const
       
    62 	{
       
    63 	// Use the base class version to get the list of matches
       
    64 	RImplInfoArray* retList = CDefaultResolver::ListAllL(aInterfaceUid, aAdditionalParameters);
       
    65 
       
    66 	// Now remove any from the list that aren't in ROM (or are upgrades of ROM)
       
    67 	const TInt count = retList->Count();
       
    68 	for(TInt index = count-1; index >=0; --index)
       
    69 		if(!(*retList)[index]->RomBased())
       
    70 			retList->Remove(index);
       
    71 
       
    72 	return retList;
       
    73 	}
       
    74