loggingservices/eventlogger/LogServ/inc/LogServResourceInterpreter.h
changeset 51 7d4490026038
parent 0 08ec8eefde2f
equal deleted inserted replaced
40:b8bdbc8f59c7 51:7d4490026038
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    19 #include <barsc.h>
    19 #include <barsc.h>
    20 #include <barsread.h>
    20 #include <barsread.h>
    21 #include <logcli.h>
    21 #include <logcli.h>
    22 
    22 
    23 /**
    23 /**
    24 Gives an access to the server resource file and maintains a cache of the retrieved resource entries.
    24 Gives an access to the LogWrap resource file and maintains a cache of the retrieved resource entries.
    25 
    25 
    26 @internalComponent
    26 @internalComponent
    27 */
    27 */
    28 class CLogServResourceInterpreter : public CBase
    28 class CLogServResourceInterpreter : public CBase
    29 	{
    29 	{
    30 public:
    30 public:
    31 	enum TResourceType
    31 	static CLogServResourceInterpreter* NewL(RFs& aFs);
    32 		{
       
    33 		ELogWrap = 0,
       
    34 		ELogServer
       
    35 		};
       
    36 
       
    37 public:
       
    38 	static CLogServResourceInterpreter* NewL(RFs& aFsSession);
       
    39 	~CLogServResourceInterpreter();
    32 	~CLogServResourceInterpreter();
    40     void CreateResourceReaderLC(TResourceReader& aReader, TInt aId, TResourceType aType) ;//Create a resource reader for a specific resource entry
    33     void CreateResourceReaderLC(TResourceReader& aReader, TInt aId);
    41 
    34 
    42 private:
    35 private:
    43     /**
    36     /**
       
    37     Resource file item.
       
    38     Holds one resource string identified by an id.
    44     @internalComponent
    39     @internalComponent
    45     */
    40     */
    46 	struct TResourceFileEntry
    41 	struct TResourceString
    47 	    {
    42 	    {
    48 		RResourceFile iFile;
    43 		inline TResourceString(TInt aResourceId, HBufC8* aResourceString) :
    49 		TResourceType iType;
    44 			iId(aResourceId),
       
    45 			iString(aResourceString)
       
    46 			{
       
    47 			}
       
    48 		TInt		iId;
       
    49 		HBufC8*		iString;
    50 	    };
    50 	    };
    51 
    51 
    52     /**
    52     CLogServResourceInterpreter(RFs& aFs);
    53     @internalComponent
       
    54     */
       
    55 	class CResourceStringCacheEntry : public CBase
       
    56 	    {
       
    57 	public:
       
    58 		static CResourceStringCacheEntry* NewL(TInt aResourceId, CLogServResourceInterpreter::TResourceType aResourceType, HBufC8* aResourceString);
       
    59 		~CResourceStringCacheEntry();
       
    60 		TUint ResourceId(void) ;
       
    61 		CLogServResourceInterpreter::TResourceType ResourceType(void) ;
       
    62 		HBufC8* ResourceString (void) ;
       
    63 		static TInt Offset();
       
    64 		
       
    65 	private:
       
    66 		CResourceStringCacheEntry (TInt aResourceId, CLogServResourceInterpreter::TResourceType aType, HBufC8* aResourceString);
       
    67 		
       
    68 	private :
       
    69 		TSglQueLink iLink;
       
    70 		TUint iResourceId ;
       
    71 		CLogServResourceInterpreter::TResourceType iResourceType ;
       
    72 		HBufC8* iResourceString ;
       
    73 	    };
       
    74 
       
    75     CLogServResourceInterpreter(RFs& aFsSession);
       
    76     void ConstructL();
    53     void ConstructL();
    77 	void LoadResourceFileL(const TDesC& aName, TResourceType aType);
    54 	HBufC8* GetStringL(TInt aId);
    78 	const RResourceFile& ResourceFileForType(TResourceType aType) const;
    55 	static TInt Compare(const TResourceString& aLeft, const TResourceString& aRight);
    79 	CResourceStringCacheEntry* FindCachedResourceString(const TInt aId, TResourceType aType) ;
       
    80 	HBufC8* GetResourceBufferL(TInt aId, TResourceType aType) ;
       
    81 		
    56 		
    82 private:
    57 private:
    83 	RFs& iFsSession;
    58 	RFs& 					iFs;
    84 	RArray<TResourceFileEntry> iResourceFiles;
    59 	RResourceFile 			iFile;
    85 	//Used to cache strings read from resource file
    60 	RArray<TResourceString>	iStrings;
    86 	TSglQue<CResourceStringCacheEntry> iResourceStringCache;
       
    87 	TSglQueIter<CResourceStringCacheEntry> iResourceStringCacheIter;
       
    88 	};
    61 	};
    89 
    62 
    90 #endif
    63 #endif