25
|
1 |
/*
|
|
2 |
* Copyright (c) 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: Generic field event declaration
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef CESMRGENERICFIELDEVENT_H
|
|
20 |
#define CESMRGENERICFIELDEVENT_H
|
|
21 |
|
|
22 |
#include <e32base.h>
|
|
23 |
|
|
24 |
#include "mesmrfieldevent.h"
|
|
25 |
|
|
26 |
class CESMRFieldEventValue;
|
|
27 |
class CESMRField;
|
|
28 |
|
|
29 |
/**
|
|
30 |
* Generic field event.
|
|
31 |
* Field event implementation with type information and any parameter count.
|
|
32 |
*
|
|
33 |
* @code
|
|
34 |
* MESMRFieldEvent::TEventType type = MESMRFieldEvent::EESMRFieldChangeEvent;
|
|
35 |
* CESMRGenericFieldEvent* event = CESMRGenericFieldEvent::NewLC( type );
|
|
36 |
* event->AddParamL( param );
|
|
37 |
* CESMRField::NotifyEventL( *event );
|
|
38 |
* CleanupStack::PopAndDestroy( event );
|
|
39 |
* @endcode
|
|
40 |
*
|
|
41 |
* @lib esmrfieldbuildercommon.lib
|
|
42 |
*/
|
|
43 |
NONSHARABLE_CLASS( CESMRGenericFieldEvent ) : public CBase,
|
|
44 |
public MESMRFieldEvent
|
|
45 |
{
|
|
46 |
|
|
47 |
public:
|
|
48 |
|
|
49 |
/**
|
|
50 |
* Two-phased constructor.
|
|
51 |
* @param aType the event type.
|
|
52 |
*/
|
|
53 |
IMPORT_C static CESMRGenericFieldEvent* NewL(
|
|
54 |
MESMRFieldEventNotifier* aSource,
|
|
55 |
MESMRFieldEvent::TEventType aType );
|
|
56 |
|
|
57 |
/**
|
|
58 |
* Two-phased constructor.
|
|
59 |
* @param aType the event type.
|
|
60 |
*/
|
|
61 |
IMPORT_C static CESMRGenericFieldEvent* NewLC(
|
|
62 |
MESMRFieldEventNotifier* aSource,
|
|
63 |
MESMRFieldEvent::TEventType aType );
|
|
64 |
|
|
65 |
/**
|
|
66 |
* Destructor.
|
|
67 |
*/
|
|
68 |
virtual ~CESMRGenericFieldEvent();
|
|
69 |
|
|
70 |
/**
|
|
71 |
* Adds parameter to event.
|
|
72 |
* Ownership is transferred.
|
|
73 |
*
|
|
74 |
* @param aValue parameter
|
|
75 |
* @param aEncapsulate. If ETrue, aValue stored as CESMRFieldEventValue.
|
|
76 |
*/
|
|
77 |
IMPORT_C void AddParamL( CESMRFieldEventValue* aValue,
|
|
78 |
TBool aEncapsulate = EFalse );
|
|
79 |
|
|
80 |
// from base class MESMRFieldEvent
|
|
81 |
|
|
82 |
/**
|
|
83 |
* From MESMRFieldEvent.
|
|
84 |
* Gets event type
|
|
85 |
*/
|
|
86 |
MESMRFieldEvent::TEventType Type() const;
|
|
87 |
|
|
88 |
/**
|
|
89 |
* From MESMRFieldEvent.
|
|
90 |
* Gets the event source.
|
|
91 |
*
|
|
92 |
* @return pointer to the sender.
|
|
93 |
*/
|
|
94 |
MESMRFieldEventNotifier* Source() const;
|
|
95 |
/**
|
|
96 |
* From MESMRFieldEvent.
|
|
97 |
* Gets the event parameter count.
|
|
98 |
*
|
|
99 |
* @return the parameter count.
|
|
100 |
*/
|
|
101 |
TInt ParamCount() const;
|
|
102 |
|
|
103 |
/**
|
|
104 |
* From MESMRFieldEvent.
|
|
105 |
* Gets the event parameter.
|
|
106 |
*
|
|
107 |
* @param aIndex parameter index.
|
|
108 |
* @return the parameter.
|
|
109 |
*/
|
|
110 |
TAny* Param( TInt aIndex ) const;
|
|
111 |
|
|
112 |
private:
|
|
113 |
|
|
114 |
CESMRGenericFieldEvent( MESMRFieldEventNotifier* aSource,
|
|
115 |
MESMRFieldEvent::TEventType aType );
|
|
116 |
|
|
117 |
private: // data
|
|
118 |
|
|
119 |
/**
|
|
120 |
* Event type
|
|
121 |
*/
|
|
122 |
MESMRFieldEvent::TEventType iType;
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Event source.
|
|
126 |
* Not owned.
|
|
127 |
*/
|
|
128 |
MESMRFieldEventNotifier* iSource;
|
|
129 |
|
|
130 |
/**
|
|
131 |
* Array of parameters
|
|
132 |
*/
|
|
133 |
RPointerArray< MESMRFieldEventValue > iParams;
|
|
134 |
|
|
135 |
};
|
|
136 |
|
|
137 |
NONSHARABLE_CLASS( CESMRFieldEventValue ) : public CBase,
|
|
138 |
public MESMRFieldEventValue
|
|
139 |
{
|
|
140 |
|
|
141 |
public:
|
|
142 |
|
|
143 |
/**
|
|
144 |
* Two-phased constructor.
|
|
145 |
* @param aType the value type.
|
|
146 |
* @param aValue value
|
|
147 |
*/
|
|
148 |
IMPORT_C static CESMRFieldEventValue* NewL(
|
|
149 |
MESMRFieldEventValue::TValueType aType,
|
|
150 |
TAny* aValue );
|
|
151 |
/**
|
|
152 |
* Two-phased constructor.
|
|
153 |
* @param aType the value type.
|
|
154 |
* @param aValue value
|
|
155 |
*/
|
|
156 |
IMPORT_C static CESMRFieldEventValue* NewLC(
|
|
157 |
MESMRFieldEventValue::TValueType aType,
|
|
158 |
TAny* aValue );
|
|
159 |
|
|
160 |
/**
|
|
161 |
* Destructor.
|
|
162 |
*/
|
|
163 |
virtual ~CESMRFieldEventValue();
|
|
164 |
|
|
165 |
/**
|
|
166 |
* Gets the value type
|
|
167 |
*/
|
|
168 |
MESMRFieldEventValue::TValueType Type() const;
|
|
169 |
|
|
170 |
/**
|
|
171 |
* Gets the value.
|
|
172 |
*/
|
|
173 |
TAny* Value() const;
|
|
174 |
|
|
175 |
/**
|
|
176 |
* Gets the value as TInt.
|
|
177 |
*/
|
|
178 |
TInt IntValue() const;
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Gets the value as TDesC16&.
|
|
182 |
*/
|
|
183 |
const TDesC& StringValue() const;
|
|
184 |
|
|
185 |
/**
|
|
186 |
* Gets the value as TDesC8&.
|
|
187 |
*/
|
|
188 |
const TDesC8& String8Value() const;
|
|
189 |
|
|
190 |
/**
|
|
191 |
* Gets the value as CESMRField&.
|
|
192 |
*/
|
|
193 |
const CESMRField& FieldValue() const;
|
|
194 |
|
|
195 |
/**
|
|
196 |
* Gets the value as CBase*.
|
|
197 |
*/
|
|
198 |
const CBase* CBaseValue() const;
|
|
199 |
|
|
200 |
/**
|
|
201 |
* Gets the value as TTime.
|
|
202 |
*/
|
|
203 |
TTime TimeValue() const;
|
|
204 |
|
|
205 |
private:
|
|
206 |
|
|
207 |
CESMRFieldEventValue( MESMRFieldEventValue::TValueType aType);
|
|
208 |
|
|
209 |
void ConstructL( TAny* aValue );
|
|
210 |
|
|
211 |
private: // data
|
|
212 |
|
|
213 |
MESMRFieldEventValue::TValueType iType;
|
|
214 |
|
|
215 |
TAny* iValue;
|
|
216 |
};
|
|
217 |
|
|
218 |
#endif // CESMRGENERICFIELDEVENT_H
|