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