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 implementation of the accessor class upon the RStringPool sl@0: // sl@0: // sl@0: sl@0: // ______________________________________________________________________________ sl@0: // sl@0: _LIT(KTStringPool_DumpName,"C:\\System\\Data\\Logs\\TStringPool_StateDump.bin"); sl@0: sl@0: inline TInt TStringPool_StateAccessor::InvariantTest(TAny* aTestObject) sl@0: { sl@0: if(aTestObject) sl@0: { sl@0: } sl@0: return KErrNone; sl@0: } sl@0: sl@0: inline TInt TStringPool_StateAccessor::Internalize(TAny* aTestObject) sl@0: { sl@0: TInt error = KErrNone; sl@0: if(aTestObject != NULL) sl@0: { sl@0: RStringPool* StringPool = REINTERPRET_CAST(RStringPool*, aTestObject); sl@0: TRAP(error,InternalizeL(StringPool)); sl@0: } sl@0: return error; sl@0: } sl@0: sl@0: inline TInt TStringPool_StateAccessor::Externalize(TAny* aTestObject) sl@0: { sl@0: TInt error = KErrNone; sl@0: if(aTestObject != NULL) sl@0: { sl@0: RStringPool* StringPool = REINTERPRET_CAST(RStringPool*, aTestObject); sl@0: TRAP(error,ExternalizeL(StringPool)); sl@0: } sl@0: return error; sl@0: } sl@0: sl@0: inline void TStringPool_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, RStringPool* /* aLoadManager */) sl@0: { sl@0: } sl@0: sl@0: inline void TStringPool_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, RStringPool* /* aLoadManager */) sl@0: { sl@0: } sl@0: sl@0: // internal helpers sl@0: inline void TStringPool_StateAccessor::InternalizeL(RStringPool* aStringPool) 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(KTStringPool_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, aStringPool); sl@0: CleanupStack::PopAndDestroy(); // stream sl@0: CleanupStack::PopAndDestroy(); // fs sl@0: } sl@0: sl@0: inline void TStringPool_StateAccessor::ExternalizeL(RStringPool* aStringPool) 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(KTStringPool_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, aStringPool); sl@0: CleanupStack::PopAndDestroy(); // stream sl@0: CleanupStack::PopAndDestroy(); // fs sl@0: } sl@0: