loggingservices/eventlogger/LogServ/inc/LogServResourceInterpreter.h
author Pat Downey <patd@symbian.org>
Wed, 01 Sep 2010 12:39:58 +0100
branchRCL_3
changeset 24 cc28652e0254
parent 0 08ec8eefde2f
permissions -rw-r--r--
Revert incorrect RCL_3 drop: Revision: 201035 Kit: 201035

// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

#ifndef __LOGSERVRESOURCEINTERPRETER_H__
#define __LOGSERVRESOURCEINTERPRETER_H__

#include <barsc.h>
#include <barsread.h>
#include <logcli.h>

/**
Gives an access to the server resource file and maintains a cache of the retrieved resource entries.

@internalComponent
*/
class CLogServResourceInterpreter : public CBase
	{
public:
	enum TResourceType
		{
		ELogWrap = 0,
		ELogServer
		};

public:
	static CLogServResourceInterpreter* NewL(RFs& aFsSession);
	~CLogServResourceInterpreter();
    void CreateResourceReaderLC(TResourceReader& aReader, TInt aId, TResourceType aType) ;//Create a resource reader for a specific resource entry

private:
    /**
    @internalComponent
    */
	struct TResourceFileEntry
	    {
		RResourceFile iFile;
		TResourceType iType;
	    };

    /**
    @internalComponent
    */
	class CResourceStringCacheEntry : public CBase
	    {
	public:
		static CResourceStringCacheEntry* NewL(TInt aResourceId, CLogServResourceInterpreter::TResourceType aResourceType, HBufC8* aResourceString);
		~CResourceStringCacheEntry();
		TUint ResourceId(void) ;
		CLogServResourceInterpreter::TResourceType ResourceType(void) ;
		HBufC8* ResourceString (void) ;
		static TInt Offset();
		
	private:
		CResourceStringCacheEntry (TInt aResourceId, CLogServResourceInterpreter::TResourceType aType, HBufC8* aResourceString);
		
	private :
		TSglQueLink iLink;
		TUint iResourceId ;
		CLogServResourceInterpreter::TResourceType iResourceType ;
		HBufC8* iResourceString ;
	    };

    CLogServResourceInterpreter(RFs& aFsSession);
    void ConstructL();
	void LoadResourceFileL(const TDesC& aName, TResourceType aType);
	const RResourceFile& ResourceFileForType(TResourceType aType) const;
	CResourceStringCacheEntry* FindCachedResourceString(const TInt aId, TResourceType aType) ;
	HBufC8* GetResourceBufferL(TInt aId, TResourceType aType) ;
		
private:
	RFs& iFsSession;
	RArray<TResourceFileEntry> iResourceFiles;
	//Used to cache strings read from resource file
	TSglQue<CResourceStringCacheEntry> iResourceStringCache;
	TSglQueIter<CResourceStringCacheEntry> iResourceStringCacheIter;
	};

#endif