85
|
1 |
/*
|
|
2 |
* Copyright (c) 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: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <badesca.h>
|
86
|
19 |
#include <s32strm.h>
|
85
|
20 |
#include "cadef.h"
|
|
21 |
#include "cainnerquery.h"
|
|
22 |
|
|
23 |
// ======== MEMBER FUNCTIONS ========
|
|
24 |
|
|
25 |
// ---------------------------------------------------------------------------
|
|
26 |
//
|
|
27 |
// ---------------------------------------------------------------------------
|
|
28 |
//
|
|
29 |
CCaInnerQuery::~CCaInnerQuery()
|
|
30 |
{
|
|
31 |
delete iEntryTypeNames;
|
|
32 |
iIds.Close();
|
88
|
33 |
iAttributes.ResetAndDestroy();
|
85
|
34 |
}
|
|
35 |
|
|
36 |
// ---------------------------------------------------------------------------
|
|
37 |
//
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
EXPORT_C CCaInnerQuery* CCaInnerQuery::NewL()
|
|
41 |
{
|
|
42 |
CCaInnerQuery* entry = CCaInnerQuery::NewLC();
|
|
43 |
CleanupStack::Pop( entry );
|
|
44 |
return entry;
|
|
45 |
}
|
|
46 |
|
|
47 |
// ---------------------------------------------------------------------------
|
|
48 |
//
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
EXPORT_C CCaInnerQuery* CCaInnerQuery::NewLC()
|
|
52 |
{
|
|
53 |
CCaInnerQuery* self = new ( ELeave ) CCaInnerQuery();
|
|
54 |
CleanupStack::PushL( self );
|
|
55 |
self->ConstructL();
|
|
56 |
return self;
|
|
57 |
}
|
|
58 |
|
|
59 |
// ---------------------------------------------------------------------------
|
|
60 |
//
|
|
61 |
// ---------------------------------------------------------------------------
|
|
62 |
//
|
|
63 |
EXPORT_C void CCaInnerQuery::ExternalizeL( RWriteStream& aStream ) const
|
|
64 |
{
|
|
65 |
aStream.WriteInt32L( iParentId );
|
|
66 |
aStream.WriteInt32L( iRole );
|
|
67 |
aStream.WriteUint32L( iFlagsOn );
|
|
68 |
aStream.WriteUint32L( iFlagsOff );
|
|
69 |
aStream.WriteUint32L( iUid );
|
|
70 |
aStream.WriteUint32L( iSort );
|
|
71 |
aStream.WriteUint32L( iCount );
|
|
72 |
aStream.WriteUint32L( iIds.Count() );
|
|
73 |
for( TInt i = 0; i < iIds.Count(); i++ )
|
|
74 |
{
|
|
75 |
aStream.WriteInt32L( iIds[i] );
|
|
76 |
}
|
|
77 |
|
|
78 |
aStream.WriteUint32L( iEntryTypeNames->MdcaCount() );
|
|
79 |
for( TInt i = 0; i < iEntryTypeNames->MdcaCount(); i++ )
|
|
80 |
{
|
|
81 |
aStream.WriteInt32L( iEntryTypeNames->MdcaPoint( i ).Length() );
|
|
82 |
aStream.WriteL( iEntryTypeNames->MdcaPoint( i ),
|
|
83 |
iEntryTypeNames->MdcaPoint( i ).Length() );
|
|
84 |
}
|
88
|
85 |
iAttributes.ExternalizeL( aStream );
|
|
86 |
aStream.CommitL();
|
85
|
87 |
}
|
|
88 |
|
|
89 |
// ---------------------------------------------------------------------------
|
|
90 |
//
|
|
91 |
// ---------------------------------------------------------------------------
|
|
92 |
//
|
|
93 |
EXPORT_C void CCaInnerQuery::InternalizeL( RReadStream& aStream )
|
|
94 |
{
|
|
95 |
iParentId = aStream.ReadInt32L();
|
|
96 |
iRole = aStream.ReadInt32L();
|
|
97 |
iFlagsOn = aStream.ReadUint32L();
|
|
98 |
iFlagsOff = aStream.ReadUint32L();
|
|
99 |
iUid = aStream.ReadUint32L();
|
|
100 |
iSort = aStream.ReadUint32L();
|
|
101 |
iCount = aStream.ReadUint32L();
|
|
102 |
TInt count = aStream.ReadUint32L();
|
|
103 |
iIds.Close();
|
|
104 |
for( TInt i = 0; i < count; i++ )
|
|
105 |
{
|
|
106 |
iIds.AppendL( aStream.ReadInt32L() );
|
|
107 |
}
|
|
108 |
iEntryTypeNames->Reset();
|
|
109 |
count = aStream.ReadUint32L();
|
|
110 |
for( TInt i = 0; i < count; i++ )
|
|
111 |
{
|
|
112 |
TInt length = aStream.ReadInt32L();
|
|
113 |
RBuf16 buf;
|
|
114 |
CleanupClosePushL( buf );
|
|
115 |
buf.CreateL( length );
|
|
116 |
aStream.ReadL( buf, length );
|
|
117 |
iEntryTypeNames->AppendL( buf );
|
|
118 |
CleanupStack::PopAndDestroy( &buf );
|
|
119 |
}
|
88
|
120 |
iAttributes.InternalizeL( aStream );
|
85
|
121 |
}
|
|
122 |
|
|
123 |
// ---------------------------------------------------------------------------
|
|
124 |
//
|
|
125 |
// ---------------------------------------------------------------------------
|
|
126 |
//
|
|
127 |
void CCaInnerQuery::ConstructL()
|
|
128 |
{
|
|
129 |
iEntryTypeNames = new ( ELeave ) CDesC16ArrayFlat( KDefaultGranularity );
|
|
130 |
iParentId = -1;
|
|
131 |
// TODO Item | Group
|
|
132 |
iRole = CCaInnerQuery::Item | CCaInnerQuery::Group;
|
|
133 |
}
|
|
134 |
|
|
135 |
// ---------------------------------------------------------------------------
|
|
136 |
//
|
|
137 |
// ---------------------------------------------------------------------------
|
|
138 |
//
|
|
139 |
CCaInnerQuery::CCaInnerQuery()
|
|
140 |
{
|
|
141 |
|
|
142 |
}
|
|
143 |
|
|
144 |
// ---------------------------------------------------------------------------
|
|
145 |
//
|
|
146 |
// ---------------------------------------------------------------------------
|
|
147 |
//
|
|
148 |
EXPORT_C const RArray<TInt>& CCaInnerQuery::GetIds() const
|
|
149 |
{
|
|
150 |
return iIds;
|
|
151 |
}
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
EXPORT_C void CCaInnerQuery::SetIdsL( const RArray<TInt>& aArray )
|
|
157 |
{
|
|
158 |
for( TInt i( 0 ); i < aArray.Count(); ++i )
|
|
159 |
{
|
|
160 |
iIds.AppendL( aArray[i] );
|
|
161 |
}
|
|
162 |
}
|
|
163 |
|
|
164 |
// ---------------------------------------------------------------------------
|
|
165 |
//
|
|
166 |
// ---------------------------------------------------------------------------
|
|
167 |
//
|
|
168 |
EXPORT_C TInt CCaInnerQuery::GetParentId() const
|
|
169 |
{
|
|
170 |
return iParentId;
|
|
171 |
}
|
|
172 |
|
|
173 |
// ---------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
// ---------------------------------------------------------------------------
|
|
176 |
//
|
|
177 |
EXPORT_C void CCaInnerQuery::SetParentId( TInt aId )
|
|
178 |
{
|
|
179 |
iParentId = aId;
|
|
180 |
}
|
|
181 |
|
|
182 |
// ---------------------------------------------------------------------------
|
|
183 |
//
|
|
184 |
// ---------------------------------------------------------------------------
|
|
185 |
//
|
|
186 |
EXPORT_C const CDesC16ArrayFlat* CCaInnerQuery::GetEntryTypeNames() const
|
|
187 |
{
|
|
188 |
return iEntryTypeNames;
|
|
189 |
}
|
|
190 |
|
|
191 |
// ---------------------------------------------------------------------------
|
|
192 |
//
|
|
193 |
// ---------------------------------------------------------------------------
|
|
194 |
//
|
|
195 |
EXPORT_C void CCaInnerQuery::SetEntryTypeNames( CDesC16ArrayFlat* aArray )
|
|
196 |
{
|
|
197 |
//TODO: Quickt setter for now, probably sth more convinient needed
|
|
198 |
ASSERT( aArray );
|
|
199 |
delete iEntryTypeNames;
|
|
200 |
iEntryTypeNames = aArray;
|
|
201 |
}
|
|
202 |
|
|
203 |
// ---------------------------------------------------------------------------
|
|
204 |
//
|
|
205 |
// ---------------------------------------------------------------------------
|
|
206 |
//
|
|
207 |
EXPORT_C TInt CCaInnerQuery::GetRole() const
|
|
208 |
{
|
|
209 |
return iRole;
|
|
210 |
}
|
|
211 |
|
|
212 |
// ---------------------------------------------------------------------------
|
|
213 |
//
|
|
214 |
// ---------------------------------------------------------------------------
|
|
215 |
//
|
|
216 |
EXPORT_C void CCaInnerQuery::SetRole( TInt aRole )
|
|
217 |
{
|
|
218 |
iRole = aRole;
|
|
219 |
}
|
|
220 |
|
|
221 |
// ---------------------------------------------------------------------------
|
|
222 |
//
|
|
223 |
// ---------------------------------------------------------------------------
|
|
224 |
//
|
|
225 |
EXPORT_C TUint CCaInnerQuery::GetFlagsOn() const
|
|
226 |
{
|
|
227 |
return iFlagsOn;
|
|
228 |
}
|
|
229 |
|
|
230 |
// ---------------------------------------------------------------------------
|
|
231 |
//
|
|
232 |
// ---------------------------------------------------------------------------
|
|
233 |
//
|
|
234 |
EXPORT_C void CCaInnerQuery::SetFlagsOn( TUint aFlagsOn )
|
|
235 |
{
|
|
236 |
iFlagsOn = aFlagsOn;
|
|
237 |
}
|
|
238 |
|
|
239 |
// ---------------------------------------------------------------------------
|
|
240 |
//
|
|
241 |
// ---------------------------------------------------------------------------
|
|
242 |
//
|
|
243 |
EXPORT_C TUint CCaInnerQuery::GetFlagsOff() const
|
|
244 |
{
|
|
245 |
return iFlagsOff;
|
|
246 |
}
|
|
247 |
|
|
248 |
// ---------------------------------------------------------------------------
|
|
249 |
//
|
|
250 |
// ---------------------------------------------------------------------------
|
|
251 |
//
|
|
252 |
EXPORT_C void CCaInnerQuery::SetFlagsOff( TUint aFlagsOff )
|
|
253 |
{
|
|
254 |
iFlagsOff = aFlagsOff;
|
|
255 |
}
|
|
256 |
// ---------------------------------------------------------------------------
|
|
257 |
//
|
|
258 |
// ---------------------------------------------------------------------------
|
|
259 |
//
|
|
260 |
EXPORT_C TUint CCaInnerQuery::GetUid() const
|
|
261 |
{
|
|
262 |
return iUid;
|
|
263 |
}
|
|
264 |
|
|
265 |
// ---------------------------------------------------------------------------
|
|
266 |
//
|
|
267 |
// ---------------------------------------------------------------------------
|
|
268 |
//
|
|
269 |
EXPORT_C void CCaInnerQuery::SetUid( TUint aUid )
|
|
270 |
{
|
|
271 |
iUid = aUid;
|
|
272 |
}
|
|
273 |
|
|
274 |
// ---------------------------------------------------------------------------
|
|
275 |
//
|
|
276 |
// ---------------------------------------------------------------------------
|
|
277 |
//
|
|
278 |
EXPORT_C CCaInnerQuery::TSortAttribute CCaInnerQuery::GetSort() const
|
|
279 |
{
|
|
280 |
return (TSortAttribute ) iSort;
|
|
281 |
}
|
|
282 |
|
|
283 |
// ---------------------------------------------------------------------------
|
|
284 |
//
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
EXPORT_C void CCaInnerQuery::SetSort( CCaInnerQuery::TSortAttribute aSort )
|
|
288 |
{
|
|
289 |
iSort = (TInt ) aSort;
|
|
290 |
}
|
|
291 |
|
|
292 |
// ---------------------------------------------------------------------------
|
|
293 |
//
|
|
294 |
// ---------------------------------------------------------------------------
|
|
295 |
//
|
|
296 |
EXPORT_C void CCaInnerQuery::SetCount( TUint aCount )
|
|
297 |
{
|
|
298 |
iCount = aCount;
|
|
299 |
}
|
|
300 |
|
|
301 |
// ---------------------------------------------------------------------------
|
|
302 |
//
|
|
303 |
// ---------------------------------------------------------------------------
|
|
304 |
//
|
|
305 |
EXPORT_C TUint CCaInnerQuery::GetCount() const
|
|
306 |
{
|
|
307 |
return iCount;
|
|
308 |
}
|
88
|
309 |
|
|
310 |
// ---------------------------------------------------------------------------
|
|
311 |
//
|
|
312 |
// ---------------------------------------------------------------------------
|
|
313 |
//
|
|
314 |
EXPORT_C void CCaInnerQuery::AddAttributeL( const TDesC& aKey,
|
|
315 |
const TDesC& aValue )
|
|
316 |
{
|
|
317 |
// to avoid duplicated attribute
|
|
318 |
if( iAttributes.Exist( aKey ) )
|
|
319 |
{
|
|
320 |
iAttributes.RemoveAttribute( aKey );
|
|
321 |
}
|
|
322 |
CCaEntryAttribute* attr = CCaEntryAttribute::NewLC( aKey );
|
|
323 |
attr->SetValueL( aValue );
|
|
324 |
iAttributes.AppendL( attr );
|
|
325 |
CleanupStack::Pop( attr );
|
|
326 |
}
|
|
327 |
|
|
328 |
// ---------------------------------------------------------------------------
|
|
329 |
//
|
|
330 |
// ---------------------------------------------------------------------------
|
|
331 |
//
|
|
332 |
EXPORT_C const RCaEntryAttrArray& CCaInnerQuery::GetAttributes() const
|
|
333 |
{
|
|
334 |
return iAttributes;
|
|
335 |
}
|