|
1 /* |
|
2 * Copyright (c) 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 holding label information |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPIMLABELPROVIDER_H |
|
20 #define CPIMLABELPROVIDER_H |
|
21 |
|
22 // EXTERNAL INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <badesca.h> |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class TResourceReader; |
|
29 |
|
30 /** |
|
31 * Class for holding label information |
|
32 * @since S60 3.2 |
|
33 */ |
|
34 NONSHARABLE_CLASS(CPIMLabelProvider) : public CBase |
|
35 { |
|
36 public: // Static constructors |
|
37 |
|
38 /** |
|
39 * Static two-phase constructor |
|
40 * Creates an instance of this class |
|
41 * |
|
42 * @param aReader Resource reader which is used in creation |
|
43 * @return An instance of this class |
|
44 */ |
|
45 static CPIMLabelProvider* NewL(TResourceReader& aReader); |
|
46 |
|
47 /** |
|
48 * Static two-phase constructor |
|
49 * Creates an instance of this class |
|
50 * |
|
51 * @param aReader Resource reader which is used in creation |
|
52 * @return An instance of this class. The newly created instance |
|
53 * is left to the cleanup stack |
|
54 */ |
|
55 static CPIMLabelProvider* NewLC(TResourceReader& aReader); |
|
56 |
|
57 /** |
|
58 * Destructor |
|
59 */ |
|
60 virtual ~CPIMLabelProvider(); |
|
61 |
|
62 public: // New methods |
|
63 |
|
64 /** |
|
65 * Returns the label of the requested identifier |
|
66 * The identifier can be field or attribute id |
|
67 * |
|
68 * @param aId Identifier of the requested label |
|
69 * @return Label. The caller takes ownership of the value. NULL |
|
70 * is returned if the id doesn't match |
|
71 */ |
|
72 HBufC* LabelL(const TInt aId) const; |
|
73 |
|
74 /** |
|
75 * Returns the label of the requested attribute |
|
76 * |
|
77 * @param aAttribute Attribute which label is to be retrieved |
|
78 * @return Label of the attribute. NULL is returned if the id |
|
79 * or element doesn't match |
|
80 */ |
|
81 HBufC* LabelL(const TInt aId, const TInt aElement) const; |
|
82 |
|
83 private: // Constructors |
|
84 |
|
85 /** |
|
86 * Default C++ constructor |
|
87 */ |
|
88 CPIMLabelProvider(); |
|
89 |
|
90 /** |
|
91 * Second phase constructor which constructs this class from a |
|
92 * resource file. The orginal resource file is needed in the construction |
|
93 * |
|
94 * @param aResourceFile Resource file which countains resources for |
|
95 * this provider object |
|
96 * @param aReader Resource reader from which the data is read |
|
97 */ |
|
98 void ConstructFromResourceL( |
|
99 TResourceReader& aReader); |
|
100 |
|
101 private: // Data |
|
102 |
|
103 // Identifier of the label |
|
104 TInt iId; |
|
105 // Label. Owned |
|
106 HBufC* iLabel; |
|
107 // Sub-element identifiers. Owned |
|
108 CArrayFix< TInt >* iSubElementIds; |
|
109 // Sub-element labels. Owned |
|
110 CDesCArray* iSubElementLabels; |
|
111 }; |
|
112 |
|
113 #endif // CPIMLABELPROVIDER_H |
|
114 |
|
115 // End of file |