0
|
1 |
/*
|
|
2 |
* Copyright (c) {Year(s)} {Copyright owner}.
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* {Name} {Company} ? Initial contribution
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
* {Name} {Company} ? {{Description of contribution}}
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
* {{Description of the file}}
|
|
17 |
*
|
|
18 |
*/
|
|
19 |
// System includes
|
|
20 |
|
|
21 |
// User includes
|
|
22 |
#include "transaction.h"
|
|
23 |
|
|
24 |
// Constants
|
|
25 |
|
|
26 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
27 |
|
|
28 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
29 |
|
|
30 |
// -----------------------------------------------------------------------------
|
|
31 |
// CTransactionItem::CTransactionItem()
|
|
32 |
// C++ default constructor
|
|
33 |
// -----------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
CTransactionItem::CTransactionItem( const TDesC8& aElementId )
|
|
36 |
: iElementId( aElementId.Alloc() )
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
// -----------------------------------------------------------------------------
|
|
41 |
// CTransactionItem::~CTransactionItem()
|
|
42 |
// Destructor
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
CTransactionItem::~CTransactionItem()
|
|
46 |
{
|
|
47 |
delete iElementId;
|
|
48 |
}
|
|
49 |
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
// CTransactionItem::ElementId()
|
|
52 |
//
|
|
53 |
// -----------------------------------------------------------------------------
|
|
54 |
//
|
|
55 |
const TDesC8& CTransactionItem::ElementId() const
|
|
56 |
{
|
|
57 |
return iElementId ? *iElementId : KNullDesC8();
|
|
58 |
}
|
|
59 |
|
|
60 |
// -----------------------------------------------------------------------------
|
|
61 |
// CImageTransactionItem::CImageTransactionItem
|
|
62 |
// C++ default constructor
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
//
|
|
65 |
CImageTransactionItem::CImageTransactionItem( const TDesC8& aElementId,
|
|
66 |
TInt aImageHandle, TInt aMaskHandle )
|
|
67 |
: CTransactionItem( aElementId ),
|
|
68 |
iImageHandle( aImageHandle ),
|
|
69 |
iMaskHandle( aMaskHandle ),
|
|
70 |
iPath( NULL )
|
|
71 |
{
|
|
72 |
}
|
|
73 |
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
// CImageTransactionItem::CImageTransactionItem
|
|
76 |
// C++ default constructor
|
|
77 |
// -----------------------------------------------------------------------------
|
|
78 |
//
|
|
79 |
CImageTransactionItem::CImageTransactionItem( const TDesC8& aElementId,
|
|
80 |
const TDesC& aPath )
|
|
81 |
: CTransactionItem( aElementId ),
|
|
82 |
iImageHandle( KErrBadHandle ),
|
|
83 |
iMaskHandle( KErrBadHandle ),
|
|
84 |
iPath( aPath.Alloc() )
|
|
85 |
{
|
|
86 |
}
|
|
87 |
|
|
88 |
// -----------------------------------------------------------------------------
|
|
89 |
// CImageTransactionItem::~CImageTransactionItem()
|
|
90 |
// Destructor
|
|
91 |
// -----------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
CImageTransactionItem::~CImageTransactionItem()
|
|
94 |
{
|
|
95 |
delete iPath;
|
|
96 |
}
|
|
97 |
|
|
98 |
// -----------------------------------------------------------------------------
|
|
99 |
// CImageTransactionItem::Type()
|
|
100 |
//
|
|
101 |
// -----------------------------------------------------------------------------
|
|
102 |
//
|
|
103 |
const TDesC8& CImageTransactionItem::Type() const
|
|
104 |
{
|
|
105 |
_LIT8( KImage, "image" );
|
|
106 |
|
|
107 |
return KImage();
|
|
108 |
}
|
|
109 |
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
// CImageTransactionItem::ImageHandle()
|
|
112 |
//
|
|
113 |
// -----------------------------------------------------------------------------
|
|
114 |
//
|
|
115 |
TInt CImageTransactionItem::ImageHandle() const
|
|
116 |
{
|
|
117 |
return iImageHandle;
|
|
118 |
}
|
|
119 |
|
|
120 |
// -----------------------------------------------------------------------------
|
|
121 |
// CImageTransactionItem::MaskHandle()
|
|
122 |
//
|
|
123 |
// -----------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
TInt CImageTransactionItem::MaskHandle() const
|
|
126 |
{
|
|
127 |
return iMaskHandle;
|
|
128 |
}
|
|
129 |
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
// CImageTransactionItem::Path()
|
|
132 |
//
|
|
133 |
// -----------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
const TDesC& CImageTransactionItem::Path() const
|
|
136 |
{
|
|
137 |
return iPath ? *iPath : KNullDesC();
|
|
138 |
}
|
|
139 |
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
// CTextTransactionItem::CTextTransactionItem()
|
|
142 |
// C++ default constructor
|
|
143 |
// -----------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
CTextTransactionItem::CTextTransactionItem( const TDesC8& aElementId,
|
|
146 |
const TDesC& aText )
|
|
147 |
: CTransactionItem( aElementId ),
|
|
148 |
iText( aText.Alloc() )
|
|
149 |
{
|
|
150 |
}
|
|
151 |
|
|
152 |
// -----------------------------------------------------------------------------
|
|
153 |
// CTextTransactionItem::~CTextTransactionItem()
|
|
154 |
// Destructor
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
CTextTransactionItem::~CTextTransactionItem()
|
|
158 |
{
|
|
159 |
delete iText;
|
|
160 |
}
|
|
161 |
|
|
162 |
// -----------------------------------------------------------------------------
|
|
163 |
// CTextTransactionItem::Type()
|
|
164 |
//
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
const TDesC8& CTextTransactionItem::Type() const
|
|
168 |
{
|
|
169 |
_LIT8( KText, "text" );
|
|
170 |
|
|
171 |
return KText();
|
|
172 |
}
|
|
173 |
|
|
174 |
// -----------------------------------------------------------------------------
|
|
175 |
// CTextTransactionItem::Text()
|
|
176 |
//
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
//
|
|
179 |
const TDesC& CTextTransactionItem::Text() const
|
|
180 |
{
|
|
181 |
return iText ? *iText : KNullDesC();
|
|
182 |
}
|
|
183 |
|
|
184 |
|
|
185 |
// -----------------------------------------------------------------------------
|
|
186 |
// CDataTransactionItem::CDataTransactionItem()
|
|
187 |
// C++ default constructor
|
|
188 |
// -----------------------------------------------------------------------------
|
|
189 |
//
|
|
190 |
CDataTransactionItem::CDataTransactionItem( const TDesC8& aElementId,
|
|
191 |
const TDesC8& aData )
|
|
192 |
: CTransactionItem( aElementId ),
|
|
193 |
iData( aData.Alloc() )
|
|
194 |
{
|
|
195 |
}
|
|
196 |
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
// CDataTransactionItem::~CDataTransactionItem()
|
|
199 |
// Destructor
|
|
200 |
// -----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
CDataTransactionItem::~CDataTransactionItem()
|
|
203 |
{
|
|
204 |
delete iData;
|
|
205 |
}
|
|
206 |
|
|
207 |
// -----------------------------------------------------------------------------
|
|
208 |
// CDataTransactionItem::Type()
|
|
209 |
//
|
|
210 |
// -----------------------------------------------------------------------------
|
|
211 |
//
|
|
212 |
const TDesC8& CDataTransactionItem::Type() const
|
|
213 |
{
|
|
214 |
_LIT8( KData, "data" );
|
|
215 |
|
|
216 |
return KData();
|
|
217 |
}
|
|
218 |
|
|
219 |
// -----------------------------------------------------------------------------
|
|
220 |
// CDataTransactionItem::Data()
|
|
221 |
//
|
|
222 |
// -----------------------------------------------------------------------------
|
|
223 |
//
|
|
224 |
const TDesC8& CDataTransactionItem::Data() const
|
|
225 |
{
|
|
226 |
return iData ? *iData : KNullDesC8();
|
|
227 |
}
|
|
228 |
|
|
229 |
// -----------------------------------------------------------------------------
|
|
230 |
// CTransaction::CTransaction()
|
|
231 |
// C++ default constructor
|
|
232 |
// -----------------------------------------------------------------------------
|
|
233 |
//
|
|
234 |
CTransaction::CTransaction( const TDesC& aWidgetId )
|
|
235 |
: iWidgetId( aWidgetId )
|
|
236 |
{
|
|
237 |
}
|
|
238 |
|
|
239 |
// -----------------------------------------------------------------------------
|
|
240 |
// CTransaction::~CTransaction()
|
|
241 |
// Destructor
|
|
242 |
// -----------------------------------------------------------------------------
|
|
243 |
//
|
|
244 |
CTransaction::~CTransaction()
|
|
245 |
{
|
|
246 |
iItems.ResetAndDestroy();
|
|
247 |
}
|
|
248 |
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
// CTransaction::operator==()
|
|
251 |
//
|
|
252 |
// -----------------------------------------------------------------------------
|
|
253 |
//
|
|
254 |
TBool CTransaction::operator== ( const TDesC& aWidgetId ) const
|
|
255 |
{
|
|
256 |
if ( iWidgetId == KNullDesC )
|
|
257 |
{
|
|
258 |
return EFalse;
|
|
259 |
}
|
|
260 |
|
|
261 |
return aWidgetId == iWidgetId;
|
|
262 |
}
|
|
263 |
|
|
264 |
// -----------------------------------------------------------------------------
|
|
265 |
// CTransaction::AppendL()
|
|
266 |
//
|
|
267 |
// -----------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
void CTransaction::AppendL( CTransactionItem* aItem )
|
|
270 |
{
|
|
271 |
User::LeaveIfError( iItems.InsertInAddressOrder( aItem ) );
|
|
272 |
}
|
|
273 |
|
|
274 |
// -----------------------------------------------------------------------------
|
|
275 |
// CTransaction::Items()
|
|
276 |
//
|
|
277 |
// -----------------------------------------------------------------------------
|
|
278 |
//
|
|
279 |
const RPointerArray< CTransactionItem >& CTransaction::Items() const
|
|
280 |
{
|
|
281 |
return iItems;
|
|
282 |
}
|
|
283 |
|
|
284 |
// End of file
|