sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // The state accessor class implementations for the CLoadManager class sl@0: // sl@0: // sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTLoadManager_DumpName,"C:\\System\\Data\\Logs\\TLoadManager_StateDump.bin"); sl@0: sl@0: inline TInt TLoadManager_StateAccessor::InvariantTest(TAny* aTestObject) sl@0: { sl@0: if(aTestObject) sl@0: { sl@0: // Nothing to do sl@0: // CLoadManager* LoadManager = REINTERPRET_CAST(CLoadManager*, aTestObject); sl@0: } sl@0: return KErrNone; sl@0: } sl@0: sl@0: inline TInt TLoadManager_StateAccessor::Internalize(TAny* aTestObject) sl@0: { sl@0: TInt error = KErrNone; sl@0: if(aTestObject) sl@0: { sl@0: CLoadManager* LoadManager = REINTERPRET_CAST(CLoadManager*, aTestObject); sl@0: TRAP(error,InternalizeL(LoadManager)); sl@0: } sl@0: return error; sl@0: } sl@0: sl@0: inline TInt TLoadManager_StateAccessor::Externalize(TAny* aTestObject) sl@0: { sl@0: TInt error = KErrNone; sl@0: if(aTestObject) sl@0: { sl@0: CLoadManager* LoadManager = REINTERPRET_CAST(CLoadManager*, aTestObject); sl@0: TRAP(error,ExternalizeL(LoadManager)); sl@0: } sl@0: return error; sl@0: } sl@0: sl@0: inline void TLoadManager_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CLoadManager* /* aLoadManager */) sl@0: { sl@0: // Nothing to do sl@0: } sl@0: sl@0: inline void TLoadManager_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CLoadManager* /* aLoadManager */) sl@0: { sl@0: // Nothing to do sl@0: } sl@0: sl@0: // internal helpers sl@0: inline void TLoadManager_StateAccessor::InternalizeL(CLoadManager* aLoadManager) sl@0: { sl@0: // Read in the dumped data sl@0: RFs fs; sl@0: User::LeaveIfError(fs.Connect()); sl@0: CleanupClosePushL(fs); sl@0: // Read the object dump sl@0: TParse filename; sl@0: filename.Set(KTLoadManager_DumpName(),NULL,NULL); sl@0: RFileReadStream stream; sl@0: User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead)); sl@0: CleanupClosePushL(stream); sl@0: InternalizeL(stream, aLoadManager); sl@0: CleanupStack::PopAndDestroy(); // stream sl@0: CleanupStack::PopAndDestroy(); // fs sl@0: } sl@0: sl@0: inline void TLoadManager_StateAccessor::ExternalizeL(CLoadManager* aLoadManager) sl@0: { sl@0: RFs fs; sl@0: User::LeaveIfError(fs.Connect()); sl@0: CleanupClosePushL(fs); sl@0: // Write out the object dump sl@0: TParse filename; sl@0: filename.Set(KTLoadManager_DumpName(),NULL,NULL); sl@0: RFileWriteStream stream; sl@0: User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite)); sl@0: CleanupClosePushL(stream); sl@0: ExternalizeL(stream, aLoadManager); sl@0: CleanupStack::PopAndDestroy(); // stream sl@0: CleanupStack::PopAndDestroy(); // fs sl@0: }