|
1 /* |
|
2 * Copyright (c) 2004-2006 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: Class for all localization data objects. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMLOCALIZATIONDATA_H |
|
20 #define CPIMLOCALIZATIONDATA_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 #include "pimtypes.h" |
|
25 #include "mpimlocalizationdata.h" |
|
26 |
|
27 class TResourceReader; |
|
28 class RResourceFile; |
|
29 class CPIMLabelProvider; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 /** |
|
33 * Class for all localization data objects. |
|
34 * Provides common methods for accessing data in the localized resource files. |
|
35 */ |
|
36 NONSHARABLE_CLASS(CPIMLocalizationData) : public CBase, |
|
37 public MPIMLocalizationData |
|
38 { |
|
39 public: // Construction and destruction |
|
40 |
|
41 /** |
|
42 * NewL |
|
43 * Symbian two-phase constructor |
|
44 * @param aReader Resource reader associated to lists resources |
|
45 * @param aSubType Subtype of the list |
|
46 * @return New instance of this class |
|
47 */ |
|
48 static CPIMLocalizationData* NewL( |
|
49 RResourceFile& aResourceFile, |
|
50 TResourceReader& aReader, |
|
51 TInt aSubType); |
|
52 |
|
53 /** |
|
54 * NewLC |
|
55 * Symbian two-phase constructor |
|
56 * @param aReader Resource reader associated to lists resources |
|
57 * @param aSubType Subtype of the list |
|
58 * @return New instance of this class. The item is left |
|
59 * to the cleanup stack |
|
60 */ |
|
61 static CPIMLocalizationData* NewLC( |
|
62 RResourceFile& aResourceFile, |
|
63 TResourceReader& aReader, |
|
64 TInt aSubType); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 virtual ~CPIMLocalizationData(); |
|
70 |
|
71 public: // From MPIMLocalizationData |
|
72 |
|
73 /** |
|
74 * Provides a string label associated with the given field. The caller |
|
75 * takes ownership of the returned object. |
|
76 * |
|
77 * @param aField The field for which the label is being queried. |
|
78 * |
|
79 * @return String label for the field. The label is locale specific. |
|
80 */ |
|
81 HBufC* GetFieldLabelL(TPIMField aField); |
|
82 |
|
83 /** |
|
84 * Provides a string label associated with the given attribute. |
|
85 * The caller takes ownership of the returned object. |
|
86 * |
|
87 * @param aAttribute The attribute for which the label is being queried. |
|
88 * |
|
89 * @return String label for the attribute. The label is locale specific. |
|
90 */ |
|
91 HBufC* GetAttributeLabelL(TPIMAttribute aAttribute); |
|
92 |
|
93 /** |
|
94 * Provides a string label associated with the given array element. |
|
95 * The caller takes ownership of the returned object. |
|
96 * |
|
97 * @param aStringArrayField The field which has a EPIMFieldStringArray |
|
98 * data type. |
|
99 * @param aArrayElement The element in the array. |
|
100 * |
|
101 * @return String label for the array element |
|
102 */ |
|
103 HBufC* GetArrayElementLabelL(TPIMField aStringArrayField, |
|
104 TPIMArrayElement aArrayElement); |
|
105 /** |
|
106 * Provides the name of the list. |
|
107 * The caller takes ownership of the returned object. |
|
108 * |
|
109 * @return the list name. |
|
110 */ |
|
111 HBufC* GetListNameL(); |
|
112 |
|
113 private: // Constructors |
|
114 |
|
115 /** |
|
116 * Default C++ constructor |
|
117 */ |
|
118 CPIMLocalizationData(TInt aSubType); |
|
119 |
|
120 /** |
|
121 * Second phase constructor. |
|
122 * Constructs this class from a resource structure |
|
123 * @param aReader Resource reader pointed to a resource file |
|
124 */ |
|
125 void ConstructFromResourceL( |
|
126 RResourceFile& aResourceFile, |
|
127 TResourceReader& aReader); |
|
128 |
|
129 private: // New methods |
|
130 |
|
131 /** |
|
132 * Reads list label information from a resource structure |
|
133 * @param aReader Resource reader pointed to a resource file |
|
134 */ |
|
135 void ReadListInfoFromResourceL( |
|
136 RResourceFile& aResourceFile, |
|
137 TResourceReader& aReader); |
|
138 |
|
139 private: // Data |
|
140 |
|
141 // Subtype of the list |
|
142 TInt iSubType; |
|
143 // List name. Owned |
|
144 HBufC* iListName; |
|
145 // Field labels. Owned |
|
146 RPointerArray< CPIMLabelProvider > iFields; |
|
147 // Attribute labels. Owned |
|
148 RPointerArray< CPIMLabelProvider > iAttributes; |
|
149 }; |
|
150 |
|
151 #endif // CPIMLOCALIZATIONDATA_H |
|
152 |
|
153 // End of file |