|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Caches language specific text fields from a |
|
15 * resource file and provides access to them. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 #ifndef CESMRAGNVERSIT2STRINGPROVIDER_H |
|
21 #define CESMRAGNVERSIT2STRINGPROVIDER_H |
|
22 |
|
23 //System includes |
|
24 #include <e32base.h> // CBase |
|
25 #include <f32file.h> // RFs |
|
26 #include <barsc.h> // RResourceFile |
|
27 #include <barsread.h> // TResourceReader |
|
28 |
|
29 //User includes |
|
30 #include "esmragnversit2strings.hrh" // TStringId |
|
31 |
|
32 /** |
|
33 * Class to load and cache strings from resource files. |
|
34 * @internalTechnology |
|
35 */ |
|
36 class CESMRAgnVersit2StringProvider : public CBase |
|
37 { |
|
38 public: // Construction/destruction. |
|
39 /** |
|
40 * Creates a new CESMRAgnVersit2StringProvider and returns it |
|
41 * @return pointer to the new CESMRAgnVersit2StringProvider |
|
42 * @internalTechnology |
|
43 */ |
|
44 static CESMRAgnVersit2StringProvider* NewL(); |
|
45 |
|
46 /** |
|
47 * C++ Destructor. |
|
48 */ |
|
49 ~CESMRAgnVersit2StringProvider(); |
|
50 |
|
51 public: // Methods. |
|
52 /** |
|
53 * Returns a string based on the TStringId parameter. If the array item at index |
|
54 * aStringId is NULL, then that particular string has not been requested yet. If |
|
55 * this is the case, then the string is retrieved from the resource file and set |
|
56 * to aIndex in the string array. |
|
57 * @param aStringId string index to return |
|
58 * @return reference to a descriptor containing the string |
|
59 * @internalTechnology |
|
60 */ |
|
61 const TDesC& StringL(TStringId aStringId); |
|
62 |
|
63 private: // Construction. |
|
64 CESMRAgnVersit2StringProvider(); |
|
65 void ConstructL(); |
|
66 |
|
67 private: // Methods. |
|
68 void ReadStringFromResourceL(TStringId aStringId); |
|
69 void ReadAllStringsL(); |
|
70 |
|
71 private: // Members. |
|
72 RFs iFs; |
|
73 HBufC* iResourceBuffer; |
|
74 RResourceFile iResourceFile; |
|
75 TResourceReader iResourceReader; |
|
76 RPointerArray<HBufC> iStringArray; |
|
77 }; |
|
78 |
|
79 #endif |
|
80 |
|
81 // End of file. |