|
1 /* |
|
2 * Copyright (c) 2007-2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_HNMDEVENTMAPPING_H |
|
21 #define C_HNMDEVENTMAPPING_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <e32hashtab.h> |
|
25 #include <xmlengdom.h> |
|
26 |
|
27 #include "hnmdmodel.h" |
|
28 |
|
29 class CHnMdEventMappingElement; |
|
30 class CHnMdItem; |
|
31 class CHnMdAction; |
|
32 struct THnMdCommonPointers; |
|
33 class CHnActionModel; |
|
34 class CHnItemModel; |
|
35 class CHnSuiteModel; |
|
36 |
|
37 /** |
|
38 * Event Mapping. |
|
39 * |
|
40 * This class is to store event mapping elements defined |
|
41 * in one suite. |
|
42 * |
|
43 * @lib hnmetadatamodel |
|
44 * @since S60 v5.0 |
|
45 * @ingroup group_hnmetadatamodel |
|
46 */ |
|
47 NONSHARABLE_CLASS(CHnMdEventMapping) : public CBase |
|
48 { |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Standard factory method. |
|
53 * |
|
54 * since S60 v5.0 |
|
55 * @param aElement Xml element. |
|
56 * @param aCmnPtrs Common pointers container. |
|
57 * @return Fully constructed object. |
|
58 */ |
|
59 static CHnMdEventMapping* NewL( TXmlEngElement aElement, |
|
60 THnMdCommonPointers* aCmnPtrs ); |
|
61 |
|
62 /** |
|
63 * Standard factory method. |
|
64 * |
|
65 * since S60 v5.0 |
|
66 * @param aElement Xml element. |
|
67 * @param aCmnPtrs Common pointers container. |
|
68 * @return Fully constructed object. |
|
69 */ |
|
70 static CHnMdEventMapping* NewLC( TXmlEngElement aElement, |
|
71 THnMdCommonPointers* aCmnPtrs ); |
|
72 |
|
73 /** |
|
74 * Fills actions models container with evaluated actions. |
|
75 * |
|
76 * since S60 v5.0 |
|
77 * @param aActions Actions container to be filled with actions models. |
|
78 * @param aQueriesResultsList Query results. |
|
79 * @param aPos Position in the query. |
|
80 */ |
|
81 void FillActionsL( RHashMap< TInt, CArrayPtr<CHnActionModel>* >& aActions, |
|
82 const CLiwGenericParamList& aQueriesResultsList, TInt aPos = 0 ); |
|
83 |
|
84 /** |
|
85 * Standard destructor. |
|
86 */ |
|
87 virtual ~CHnMdEventMapping(); |
|
88 |
|
89 /** |
|
90 * Gets list of actions correspondig to given event id. |
|
91 * |
|
92 * @param aEventId Event's identifier. |
|
93 * @return Actions list corresponding to the event. |
|
94 */ |
|
95 RPointerArray< CHnMdAction > GetActionsForEventId( TInt aEventId ); |
|
96 |
|
97 /** |
|
98 * Gets events ids. |
|
99 * |
|
100 * @param aIds Array to be filled with events ids. |
|
101 */ |
|
102 void GetEventIdsL( RArray< TInt >& aIds ) const; |
|
103 |
|
104 private: |
|
105 |
|
106 /** |
|
107 * Gets action by event id. |
|
108 * |
|
109 * @return A number of actions. |
|
110 */ |
|
111 TInt Count() const; |
|
112 |
|
113 /** |
|
114 * Gets action by event id. |
|
115 * |
|
116 * @param aActions Actions container to which action model will be added. |
|
117 * @param aActionModel An evaluated action model. |
|
118 * @param aEventId An event id. |
|
119 */ |
|
120 void AddActionL( |
|
121 RHashMap<TInt,CArrayPtr<CHnActionModel> *> & aActions, |
|
122 CHnActionModel *& aActionModel, TInt aEventId ); |
|
123 |
|
124 /** |
|
125 * default constructot |
|
126 */ |
|
127 CHnMdEventMapping(); |
|
128 |
|
129 /** |
|
130 * EPOC default constructor for performing 2nd stage construction. |
|
131 * |
|
132 * @param aElement Xml element. |
|
133 * @param aCmnPtrs Common pointers container. |
|
134 */ |
|
135 void ConstructL( TXmlEngElement aElement, |
|
136 THnMdCommonPointers* aCmnPtrs ); |
|
137 |
|
138 private: // data |
|
139 |
|
140 /** |
|
141 * Mappings. |
|
142 */ |
|
143 RPointerArray<CHnMdEventMappingElement> iMappings; |
|
144 |
|
145 /** |
|
146 * Common pointers. |
|
147 * Not own. |
|
148 */ |
|
149 THnMdCommonPointers* iCmnPtrs; |
|
150 |
|
151 }; |
|
152 |
|
153 #endif // C_HNMMEVENTMAPPING_H |