os/ossrv/lowlevellibsandfws/pluginfw/Framework/ResolverTest/ResolverStateAccessor.inl
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 // The implementation of the accessor class for CResolver.
    15 // 
    16 //
    17 
    18 // ______________________________________________________________________________
    19 //
    20 _LIT(KTDefaultResolver_DumpName,"C:\\System\\Data\\Logs\\TDefaultResolver_StateDump.bin");
    21 
    22 inline TInt TDefaultResolver_StateAccessor::InvariantTest(TAny* /*aTestObject*/)
    23 	{
    24 	// CDefaultResolver owns no data and contains no pointers so there is no invariant test
    25 
    26 	return KErrNone;
    27 	}
    28 
    29 inline TInt TDefaultResolver_StateAccessor::Internalize(TAny* aTestObject)
    30 	{
    31 	TInt error = KErrNone;
    32 	if(aTestObject != NULL)
    33 		{
    34 		CDefaultResolver* DefaultResolver = REINTERPRET_CAST(CDefaultResolver*, aTestObject);
    35 		TRAP(error,InternalizeL(DefaultResolver));
    36 		}
    37 	return error;
    38 	}
    39 
    40 inline TInt TDefaultResolver_StateAccessor::Externalize(TAny* aTestObject)
    41 	{
    42 	TInt error = KErrNone;
    43 	if(aTestObject != NULL)
    44 		{
    45 		CDefaultResolver* DefaultResolver = REINTERPRET_CAST(CDefaultResolver*, aTestObject);
    46 		TRAP(error,ExternalizeL(DefaultResolver));
    47 		}
    48 	return error;
    49 	}
    50 
    51 inline void TDefaultResolver_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CDefaultResolver* /* aLoadManager */)
    52 	{
    53 	// Not required
    54 	}
    55 
    56 inline void TDefaultResolver_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CDefaultResolver* /* aLoadManager */)
    57 	{
    58 	// Not required
    59 	}
    60 
    61 // internal helpers
    62 inline void TDefaultResolver_StateAccessor::InternalizeL(CDefaultResolver* aDefaultResolver)
    63 	{
    64 	// Read in the dumped data
    65 	RFs fs;
    66 	User::LeaveIfError(fs.Connect());
    67 	CleanupClosePushL(fs);
    68 	// Read the object dump
    69 	TParse filename;
    70 	filename.Set(KTDefaultResolver_DumpName(),NULL,NULL);
    71 	RFileReadStream stream;
    72 	User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead));
    73 	CleanupClosePushL(stream);
    74 	InternalizeL(stream, aDefaultResolver);
    75 	CleanupStack::PopAndDestroy();	// stream
    76 	CleanupStack::PopAndDestroy();	// fs
    77 	}
    78 
    79 inline void TDefaultResolver_StateAccessor::ExternalizeL(CDefaultResolver* aDefaultResolver)
    80 	{
    81 	RFs fs;
    82 	User::LeaveIfError(fs.Connect());
    83 	CleanupClosePushL(fs);
    84 	// Write out the object dump
    85 	TParse filename;
    86 	filename.Set(KTDefaultResolver_DumpName(),NULL,NULL);
    87 	RFileWriteStream stream;
    88 	User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite));
    89 	CleanupClosePushL(stream);
    90 	ExternalizeL(stream, aDefaultResolver);
    91 	CleanupStack::PopAndDestroy();	// stream
    92 	CleanupStack::PopAndDestroy();	// fs
    93 	}
    94 
    95 inline TBool TDefaultResolver_StateAccessor::Match(CDefaultResolver& aResolver,
    96 												   const TDesC8& aImplementationType, 
    97 												   const TDesC8& aMatchType, 
    98 												   TBool aUseWildcards) const
    99 	{
   100 	return aResolver.Match(aImplementationType, aMatchType, aUseWildcards);
   101 	}
   102 
   103 inline TUid TDefaultResolver_StateAccessor::Resolve(CDefaultResolver& aResolver,
   104 													RImplInfoArray& aImplementationData, 
   105 													const TEComResolverParams& aAdditionalParameters) const
   106 	{
   107 	return aResolver.Resolve(aImplementationData, aAdditionalParameters);
   108 	}