os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/ResolverStateAccessor.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/ResolverStateAccessor.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,108 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// The implementation of the accessor class for CResolver.
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +// ______________________________________________________________________________
    1.22 +//
    1.23 +_LIT(KTDefaultResolver_DumpName,"C:\\System\\Data\\Logs\\TDefaultResolver_StateDump.bin");
    1.24 +
    1.25 +inline TInt TDefaultResolver_StateAccessor::InvariantTest(TAny* /*aTestObject*/)
    1.26 +	{
    1.27 +	// CDefaultResolver owns no data and contains no pointers so there is no invariant test
    1.28 +
    1.29 +	return KErrNone;
    1.30 +	}
    1.31 +
    1.32 +inline TInt TDefaultResolver_StateAccessor::Internalize(TAny* aTestObject)
    1.33 +	{
    1.34 +	TInt error = KErrNone;
    1.35 +	if(aTestObject != NULL)
    1.36 +		{
    1.37 +		CDefaultResolver* DefaultResolver = REINTERPRET_CAST(CDefaultResolver*, aTestObject);
    1.38 +		TRAP(error,InternalizeL(DefaultResolver));
    1.39 +		}
    1.40 +	return error;
    1.41 +	}
    1.42 +
    1.43 +inline TInt TDefaultResolver_StateAccessor::Externalize(TAny* aTestObject)
    1.44 +	{
    1.45 +	TInt error = KErrNone;
    1.46 +	if(aTestObject != NULL)
    1.47 +		{
    1.48 +		CDefaultResolver* DefaultResolver = REINTERPRET_CAST(CDefaultResolver*, aTestObject);
    1.49 +		TRAP(error,ExternalizeL(DefaultResolver));
    1.50 +		}
    1.51 +	return error;
    1.52 +	}
    1.53 +
    1.54 +inline void TDefaultResolver_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CDefaultResolver* /* aLoadManager */)
    1.55 +	{
    1.56 +	// Not required
    1.57 +	}
    1.58 +
    1.59 +inline void TDefaultResolver_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CDefaultResolver* /* aLoadManager */)
    1.60 +	{
    1.61 +	// Not required
    1.62 +	}
    1.63 +
    1.64 +// internal helpers
    1.65 +inline void TDefaultResolver_StateAccessor::InternalizeL(CDefaultResolver* aDefaultResolver)
    1.66 +	{
    1.67 +	// Read in the dumped data
    1.68 +	RFs fs;
    1.69 +	User::LeaveIfError(fs.Connect());
    1.70 +	CleanupClosePushL(fs);
    1.71 +	// Read the object dump
    1.72 +	TParse filename;
    1.73 +	filename.Set(KTDefaultResolver_DumpName(),NULL,NULL);
    1.74 +	RFileReadStream stream;
    1.75 +	User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead));
    1.76 +	CleanupClosePushL(stream);
    1.77 +	InternalizeL(stream, aDefaultResolver);
    1.78 +	CleanupStack::PopAndDestroy();	// stream
    1.79 +	CleanupStack::PopAndDestroy();	// fs
    1.80 +	}
    1.81 +
    1.82 +inline void TDefaultResolver_StateAccessor::ExternalizeL(CDefaultResolver* aDefaultResolver)
    1.83 +	{
    1.84 +	RFs fs;
    1.85 +	User::LeaveIfError(fs.Connect());
    1.86 +	CleanupClosePushL(fs);
    1.87 +	// Write out the object dump
    1.88 +	TParse filename;
    1.89 +	filename.Set(KTDefaultResolver_DumpName(),NULL,NULL);
    1.90 +	RFileWriteStream stream;
    1.91 +	User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite));
    1.92 +	CleanupClosePushL(stream);
    1.93 +	ExternalizeL(stream, aDefaultResolver);
    1.94 +	CleanupStack::PopAndDestroy();	// stream
    1.95 +	CleanupStack::PopAndDestroy();	// fs
    1.96 +	}
    1.97 +
    1.98 +inline TBool TDefaultResolver_StateAccessor::Match(CDefaultResolver& aResolver,
    1.99 +												   const TDesC8& aImplementationType, 
   1.100 +												   const TDesC8& aMatchType, 
   1.101 +												   TBool aUseWildcards) const
   1.102 +	{
   1.103 +	return aResolver.Match(aImplementationType, aMatchType, aUseWildcards);
   1.104 +	}
   1.105 +
   1.106 +inline TUid TDefaultResolver_StateAccessor::Resolve(CDefaultResolver& aResolver,
   1.107 +													RImplInfoArray& aImplementationData, 
   1.108 +													const TEComResolverParams& aAdditionalParameters) const
   1.109 +	{
   1.110 +	return aResolver.Resolve(aImplementationData, aAdditionalParameters);
   1.111 +	}