|
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __LOGSERVRESOURCEINTERPRETER_H__ |
|
17 #define __LOGSERVRESOURCEINTERPRETER_H__ |
|
18 |
|
19 #include <barsc.h> |
|
20 #include <barsread.h> |
|
21 #include <logcli.h> |
|
22 |
|
23 /** |
|
24 Gives an access to the server resource file and maintains a cache of the retrieved resource entries. |
|
25 |
|
26 @internalComponent |
|
27 */ |
|
28 class CLogServResourceInterpreter : public CBase |
|
29 { |
|
30 public: |
|
31 enum TResourceType |
|
32 { |
|
33 ELogWrap = 0, |
|
34 ELogServer |
|
35 }; |
|
36 |
|
37 public: |
|
38 static CLogServResourceInterpreter* NewL(RFs& aFsSession); |
|
39 ~CLogServResourceInterpreter(); |
|
40 void CreateResourceReaderLC(TResourceReader& aReader, TInt aId, TResourceType aType) ;//Create a resource reader for a specific resource entry |
|
41 |
|
42 private: |
|
43 /** |
|
44 @internalComponent |
|
45 */ |
|
46 struct TResourceFileEntry |
|
47 { |
|
48 RResourceFile iFile; |
|
49 TResourceType iType; |
|
50 }; |
|
51 |
|
52 /** |
|
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(); |
|
77 void LoadResourceFileL(const TDesC& aName, TResourceType aType); |
|
78 const RResourceFile& ResourceFileForType(TResourceType aType) const; |
|
79 CResourceStringCacheEntry* FindCachedResourceString(const TInt aId, TResourceType aType) ; |
|
80 HBufC8* GetResourceBufferL(TInt aId, TResourceType aType) ; |
|
81 |
|
82 private: |
|
83 RFs& iFsSession; |
|
84 RArray<TResourceFileEntry> iResourceFiles; |
|
85 //Used to cache strings read from resource file |
|
86 TSglQue<CResourceStringCacheEntry> iResourceStringCache; |
|
87 TSglQueIter<CResourceStringCacheEntry> iResourceStringCacheIter; |
|
88 }; |
|
89 |
|
90 #endif |