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.
sl@0
     1
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// The implementation of the accessor class for CResolver.
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
// ______________________________________________________________________________
sl@0
    19
//
sl@0
    20
_LIT(KTDefaultResolver_DumpName,"C:\\System\\Data\\Logs\\TDefaultResolver_StateDump.bin");
sl@0
    21
sl@0
    22
inline TInt TDefaultResolver_StateAccessor::InvariantTest(TAny* /*aTestObject*/)
sl@0
    23
	{
sl@0
    24
	// CDefaultResolver owns no data and contains no pointers so there is no invariant test
sl@0
    25
sl@0
    26
	return KErrNone;
sl@0
    27
	}
sl@0
    28
sl@0
    29
inline TInt TDefaultResolver_StateAccessor::Internalize(TAny* aTestObject)
sl@0
    30
	{
sl@0
    31
	TInt error = KErrNone;
sl@0
    32
	if(aTestObject != NULL)
sl@0
    33
		{
sl@0
    34
		CDefaultResolver* DefaultResolver = REINTERPRET_CAST(CDefaultResolver*, aTestObject);
sl@0
    35
		TRAP(error,InternalizeL(DefaultResolver));
sl@0
    36
		}
sl@0
    37
	return error;
sl@0
    38
	}
sl@0
    39
sl@0
    40
inline TInt TDefaultResolver_StateAccessor::Externalize(TAny* aTestObject)
sl@0
    41
	{
sl@0
    42
	TInt error = KErrNone;
sl@0
    43
	if(aTestObject != NULL)
sl@0
    44
		{
sl@0
    45
		CDefaultResolver* DefaultResolver = REINTERPRET_CAST(CDefaultResolver*, aTestObject);
sl@0
    46
		TRAP(error,ExternalizeL(DefaultResolver));
sl@0
    47
		}
sl@0
    48
	return error;
sl@0
    49
	}
sl@0
    50
sl@0
    51
inline void TDefaultResolver_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CDefaultResolver* /* aLoadManager */)
sl@0
    52
	{
sl@0
    53
	// Not required
sl@0
    54
	}
sl@0
    55
sl@0
    56
inline void TDefaultResolver_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CDefaultResolver* /* aLoadManager */)
sl@0
    57
	{
sl@0
    58
	// Not required
sl@0
    59
	}
sl@0
    60
sl@0
    61
// internal helpers
sl@0
    62
inline void TDefaultResolver_StateAccessor::InternalizeL(CDefaultResolver* aDefaultResolver)
sl@0
    63
	{
sl@0
    64
	// Read in the dumped data
sl@0
    65
	RFs fs;
sl@0
    66
	User::LeaveIfError(fs.Connect());
sl@0
    67
	CleanupClosePushL(fs);
sl@0
    68
	// Read the object dump
sl@0
    69
	TParse filename;
sl@0
    70
	filename.Set(KTDefaultResolver_DumpName(),NULL,NULL);
sl@0
    71
	RFileReadStream stream;
sl@0
    72
	User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead));
sl@0
    73
	CleanupClosePushL(stream);
sl@0
    74
	InternalizeL(stream, aDefaultResolver);
sl@0
    75
	CleanupStack::PopAndDestroy();	// stream
sl@0
    76
	CleanupStack::PopAndDestroy();	// fs
sl@0
    77
	}
sl@0
    78
sl@0
    79
inline void TDefaultResolver_StateAccessor::ExternalizeL(CDefaultResolver* aDefaultResolver)
sl@0
    80
	{
sl@0
    81
	RFs fs;
sl@0
    82
	User::LeaveIfError(fs.Connect());
sl@0
    83
	CleanupClosePushL(fs);
sl@0
    84
	// Write out the object dump
sl@0
    85
	TParse filename;
sl@0
    86
	filename.Set(KTDefaultResolver_DumpName(),NULL,NULL);
sl@0
    87
	RFileWriteStream stream;
sl@0
    88
	User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite));
sl@0
    89
	CleanupClosePushL(stream);
sl@0
    90
	ExternalizeL(stream, aDefaultResolver);
sl@0
    91
	CleanupStack::PopAndDestroy();	// stream
sl@0
    92
	CleanupStack::PopAndDestroy();	// fs
sl@0
    93
	}
sl@0
    94
sl@0
    95
inline TBool TDefaultResolver_StateAccessor::Match(CDefaultResolver& aResolver,
sl@0
    96
												   const TDesC8& aImplementationType, 
sl@0
    97
												   const TDesC8& aMatchType, 
sl@0
    98
												   TBool aUseWildcards) const
sl@0
    99
	{
sl@0
   100
	return aResolver.Match(aImplementationType, aMatchType, aUseWildcards);
sl@0
   101
	}
sl@0
   102
sl@0
   103
inline TUid TDefaultResolver_StateAccessor::Resolve(CDefaultResolver& aResolver,
sl@0
   104
													RImplInfoArray& aImplementationData, 
sl@0
   105
													const TEComResolverParams& aAdditionalParameters) const
sl@0
   106
	{
sl@0
   107
	return aResolver.Resolve(aImplementationData, aAdditionalParameters);
sl@0
   108
	}