|
1 /* |
|
2 * Copyright (c) 2002-2004 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: Source for CNSmlDbMeta class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include <badesca.h> |
|
21 |
|
22 #include <nsmldebug.h> |
|
23 #include "nsmldbcaps.h" |
|
24 #include "smldevinfdtd.h" |
|
25 #include "smlmetinfdtd.h" |
|
26 #include "smldevinftags.h" |
|
27 |
|
28 |
|
29 // ============================= LOCAL FUNCTIONS =============================== |
|
30 |
|
31 // ----------------------------------------------------------------------------- |
|
32 // AddPCDataL |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 CXMLElement* AddPCDataL( SmlPcdataListPtr_t* aList ) |
|
36 { |
|
37 SmlPcdataListPtr_t itemL = new (ELeave) SmlPcdataList_t(); |
|
38 CleanupStack::PushL(itemL); |
|
39 itemL->data = new (ELeave) SmlPcdata_t(); |
|
40 GenericListAddL(aList, itemL); |
|
41 CleanupStack::Pop(); // itemL |
|
42 return itemL->data; |
|
43 } |
|
44 |
|
45 |
|
46 // ============================ MEMBER FUNCTIONS =============================== |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CNSmlDbMeta::NewL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C CNSmlDbMeta* CNSmlDbMeta::NewL() |
|
53 { |
|
54 //_DBG_FILE("CNSmlDbMeta::NewL(): begin"); |
|
55 CNSmlDbMeta* self = CNSmlDbMeta::NewLC(); |
|
56 CleanupStack::Pop(); // self |
|
57 //_DBG_FILE("CNSmlDbMeta::NewL(): end"); |
|
58 return self; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CNSmlDbMeta::NewLC |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 EXPORT_C CNSmlDbMeta* CNSmlDbMeta::NewLC() |
|
66 { |
|
67 //_DBG_FILE("CNSmlDbMeta::NewLC(): begin"); |
|
68 CNSmlDbMeta* self = new (ELeave) CNSmlDbMeta(); |
|
69 CleanupStack::PushL(self); |
|
70 self->ConstructL(); |
|
71 //_DBG_FILE("CNSmlDbMeta::NewLC(): end"); |
|
72 return self; |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // CNSmlDbMeta::CNSmlDbMeta |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 CNSmlDbMeta::CNSmlDbMeta() |
|
80 { |
|
81 //_DBG_FILE("CNSmlDbMeta::CNSmlDbMeta(): begin"); |
|
82 //_DBG_FILE("CNSmlDbMeta::CNSmlDbMeta(): end"); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // CNSmlDbMeta::ConstructL |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 void CNSmlDbMeta::ConstructL() |
|
90 { |
|
91 //_DBG_FILE("CNSmlDbMeta::ConstructL(): begin"); |
|
92 //_DBG_FILE("CNSmlDbMeta::ConstructL(): end"); |
|
93 } |
|
94 |
|
95 // ----------------------------------------------------------------------------- |
|
96 // CNSmlDbMeta::~CNSmlDbMeta |
|
97 // ----------------------------------------------------------------------------- |
|
98 // |
|
99 EXPORT_C CNSmlDbMeta::~CNSmlDbMeta() |
|
100 { |
|
101 //_DBG_FILE("CNSmlDbMeta::~CNSmlDbMeta(): begin"); |
|
102 delete iMetInf; |
|
103 //_DBG_FILE("CNSmlDbMeta::~CNSmlDbMeta(): end"); |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CNSmlDbMeta::MetInfL |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 EXPORT_C sml_metinf_metinf_s* CNSmlDbMeta::MetInfL() const |
|
111 { |
|
112 //_DBG_FILE("CNSmlDbMeta::MetInf(): begin"); |
|
113 //_DBG_FILE("CNSmlDbMeta::MetInf(): end"); |
|
114 sml_metinf_metinf_s* temp = iMetInf; |
|
115 iMetInf = 0; |
|
116 return temp; |
|
117 } |
|
118 |
|
119 // ----------------------------------------------------------------------------- |
|
120 // CNSmlDbMeta::Clear |
|
121 // ----------------------------------------------------------------------------- |
|
122 // |
|
123 EXPORT_C void CNSmlDbMeta::Clear() |
|
124 { |
|
125 //_DBG_FILE("CNSmlDbMeta::Clear(): begin"); |
|
126 delete iMetInf; |
|
127 iMetInf = 0; |
|
128 //_DBG_FILE("CNSmlDbMeta::Clear(): end"); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CNSmlDbMeta::CreateHandlerL |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 EXPORT_C CNSmlDbMetaHandler* CNSmlDbMeta::CreateHandlerL() const |
|
136 { |
|
137 //_DBG_FILE("CNSmlDbMeta::CreateHandlerL(): begin"); |
|
138 //_DBG_FILE("CNSmlDbMeta::CreateHandlerL(): end"); |
|
139 return new (ELeave) CNSmlDbMetaHandler(iMetInf); |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CNSmlDbMeta::SetFormatL |
|
144 // ----------------------------------------------------------------------------- |
|
145 // |
|
146 EXPORT_C void CNSmlDbMeta::SetFormatL( const TDesC8& aValue ) |
|
147 { |
|
148 //_DBG_FILE("CNSmlDbMeta::SetFormatL(): begin"); |
|
149 MakeSureMetInfExistsL(); |
|
150 if( !iMetInf->format ) |
|
151 { |
|
152 iMetInf->format = new (ELeave) SmlPcdata_t(); |
|
153 } |
|
154 iMetInf->format->SetDataL(aValue); |
|
155 //_DBG_FILE("CNSmlDbMeta::SetFormatL(): end"); |
|
156 } |
|
157 |
|
158 // ----------------------------------------------------------------------------- |
|
159 // CNSmlDbMeta::SetTypeL |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 EXPORT_C void CNSmlDbMeta::SetTypeL( const TDesC8& aValue ) |
|
163 { |
|
164 //_DBG_FILE("CNSmlDbMeta::SetTypeL(): begin"); |
|
165 MakeSureMetInfExistsL(); |
|
166 if( !iMetInf->type ) |
|
167 { |
|
168 iMetInf->type = new (ELeave) SmlPcdata_t(); |
|
169 } |
|
170 iMetInf->type->SetDataL(aValue); |
|
171 //_DBG_FILE("CNSmlDbMeta::SetTypeL(): end"); |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // CNSmlDbMeta::SetMarkL |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 EXPORT_C void CNSmlDbMeta::SetMarkL( const TDesC8& aValue ) |
|
179 { |
|
180 //_DBG_FILE("CNSmlDbMeta::SetMarkL(): begin"); |
|
181 MakeSureMetInfExistsL(); |
|
182 if( !iMetInf->mark ) |
|
183 { |
|
184 iMetInf->mark = new (ELeave) SmlPcdata_t(); |
|
185 } |
|
186 iMetInf->mark->SetDataL(aValue); |
|
187 //_DBG_FILE("CNSmlDbMeta::SetMarkL(): end"); |
|
188 } |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CNSmlDbMeta::SetSizeL |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 EXPORT_C void CNSmlDbMeta::SetSizeL( const TDesC8& aValue ) |
|
195 { |
|
196 //_DBG_FILE("CNSmlDbMeta::SetSizeL(): begin"); |
|
197 MakeSureMetInfExistsL(); |
|
198 if( !iMetInf->size ) |
|
199 { |
|
200 iMetInf->size = new (ELeave) SmlPcdata_t(); |
|
201 } |
|
202 iMetInf->size->SetDataL(aValue); |
|
203 //_DBG_FILE("CNSmlDbMeta::SetSizeL(): end"); |
|
204 } |
|
205 |
|
206 // ----------------------------------------------------------------------------- |
|
207 // CNSmlDbMeta::SetNextNonceL |
|
208 // ----------------------------------------------------------------------------- |
|
209 // |
|
210 EXPORT_C void CNSmlDbMeta::SetNextNonceL( const TDesC8& aValue ) |
|
211 { |
|
212 //_DBG_FILE("CNSmlDbMeta::SetNextNonceL(): begin"); |
|
213 MakeSureMetInfExistsL(); |
|
214 if( !iMetInf->nextnonce ) |
|
215 { |
|
216 iMetInf->nextnonce = new (ELeave) SmlPcdata_t(); |
|
217 } |
|
218 iMetInf->nextnonce->SetDataL(aValue); |
|
219 //_DBG_FILE("CNSmlDbMeta::SetNextNonceL(): end"); |
|
220 } |
|
221 |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CNSmlDbMeta::SetVersionL |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 EXPORT_C void CNSmlDbMeta::SetVersionL( const TDesC8& aValue ) |
|
227 { |
|
228 //_DBG_FILE("CNSmlDbMeta::SetVersionL(): begin"); |
|
229 MakeSureMetInfExistsL(); |
|
230 if( !iMetInf->version ) |
|
231 { |
|
232 iMetInf->version = new (ELeave) SmlPcdata_t(); |
|
233 } |
|
234 iMetInf->version->SetDataL(aValue); |
|
235 //_DBG_FILE("CNSmlDbMeta::SetVersionL(): end"); |
|
236 } |
|
237 |
|
238 // ----------------------------------------------------------------------------- |
|
239 // CNSmlDbMeta::SetMaxMsgSizeL |
|
240 // ----------------------------------------------------------------------------- |
|
241 // |
|
242 EXPORT_C void CNSmlDbMeta::SetMaxMsgSizeL( const TDesC8& aValue ) |
|
243 { |
|
244 //_DBG_FILE("CNSmlDbMeta::SetMaxMsgSizeL(): begin"); |
|
245 MakeSureMetInfExistsL(); |
|
246 if( !iMetInf->maxmsgsize ) |
|
247 { |
|
248 iMetInf->maxmsgsize = new (ELeave) SmlPcdata_t(); |
|
249 } |
|
250 iMetInf->maxmsgsize->SetDataL(aValue); |
|
251 //_DBG_FILE("CNSmlDbMeta::SetMaxMsgSizeL(): end"); |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CNSmlDbMeta::SetMaxObjSizeL |
|
256 // ----------------------------------------------------------------------------- |
|
257 // |
|
258 EXPORT_C void CNSmlDbMeta::SetMaxObjSizeL( const TDesC8& aValue ) |
|
259 { |
|
260 //_DBG_FILE("CNSmlDbMeta::SetMaxObjSizeL(): begin"); |
|
261 MakeSureMetInfExistsL(); |
|
262 if( !iMetInf->maxobjsize ) |
|
263 { |
|
264 iMetInf->maxobjsize = new (ELeave) SmlPcdata_t(); |
|
265 } |
|
266 iMetInf->maxobjsize->SetDataL(aValue); |
|
267 //_DBG_FILE("CNSmlDbMeta::SetMaxObjSizeL(): end"); |
|
268 } |
|
269 |
|
270 // ----------------------------------------------------------------------------- |
|
271 // CNSmlDbMeta::SetMemSharedL |
|
272 // ----------------------------------------------------------------------------- |
|
273 // |
|
274 EXPORT_C void CNSmlDbMeta::SetMemSharedL( const TDesC8& aValue ) |
|
275 { |
|
276 //_DBG_FILE("CNSmlDbMeta::SetMemSharedL(): begin"); |
|
277 MakeSureMetInfExistsL(); |
|
278 if( !iMetInf->mem ) |
|
279 { |
|
280 iMetInf->mem = new (ELeave) sml_metinf_mem_s(); |
|
281 } |
|
282 if( !iMetInf->mem->shared ) |
|
283 { |
|
284 iMetInf->mem->shared = new (ELeave) SmlPcdata_t(); |
|
285 } |
|
286 iMetInf->mem->shared->SetDataL(aValue); |
|
287 //_DBG_FILE("CNSmlDbMeta::SetMemSharedL(): end"); |
|
288 } |
|
289 |
|
290 // ----------------------------------------------------------------------------- |
|
291 // CNSmlDbMeta::SetMemFreeMemL |
|
292 // ----------------------------------------------------------------------------- |
|
293 // |
|
294 EXPORT_C void CNSmlDbMeta::SetMemFreeMemL( const TDesC8& aValue ) |
|
295 { |
|
296 //_DBG_FILE("CNSmlDbMeta::SetMemFreeMemL(): begin"); |
|
297 MakeSureMetInfExistsL(); |
|
298 if( !iMetInf->mem ) |
|
299 { |
|
300 iMetInf->mem = new (ELeave) sml_metinf_mem_s(); |
|
301 } |
|
302 if( !iMetInf->mem->free ) |
|
303 { |
|
304 iMetInf->mem->free = new (ELeave) SmlPcdata_t(); |
|
305 } |
|
306 iMetInf->mem->free->SetDataL(aValue); |
|
307 //_DBG_FILE("CNSmlDbMeta::SetMemFreeMemL(): end"); |
|
308 } |
|
309 |
|
310 // ----------------------------------------------------------------------------- |
|
311 // CNSmlDbMeta::SetMemFreeIDL |
|
312 // ----------------------------------------------------------------------------- |
|
313 // |
|
314 EXPORT_C void CNSmlDbMeta::SetMemFreeIDL( const TDesC8& aValue ) |
|
315 { |
|
316 //_DBG_FILE("CNSmlDbMeta::SetMemFreeIDL(): begin"); |
|
317 MakeSureMetInfExistsL(); |
|
318 if( !iMetInf->mem ) |
|
319 { |
|
320 iMetInf->mem = new (ELeave) sml_metinf_mem_s(); |
|
321 } |
|
322 if( !iMetInf->mem->freeid ) |
|
323 { |
|
324 iMetInf->mem->freeid = new (ELeave) SmlPcdata_t(); |
|
325 } |
|
326 iMetInf->mem->freeid->SetDataL(aValue); |
|
327 //_DBG_FILE("CNSmlDbMeta::SetMemFreeIDL(): end"); |
|
328 } |
|
329 |
|
330 // ----------------------------------------------------------------------------- |
|
331 // CNSmlDbMeta::SetAnchorNextL |
|
332 // ----------------------------------------------------------------------------- |
|
333 // |
|
334 EXPORT_C void CNSmlDbMeta::SetAnchorNextL( const TDesC8& aValue ) |
|
335 { |
|
336 //_DBG_FILE("CNSmlDbMeta::SetAnchorNextL(): begin"); |
|
337 MakeSureMetInfExistsL(); |
|
338 if( !iMetInf->anchor ) |
|
339 { |
|
340 iMetInf->anchor = new (ELeave) sml_metinf_anchor_s(); |
|
341 } |
|
342 if( !iMetInf->anchor->next ) |
|
343 { |
|
344 iMetInf->anchor->next = new (ELeave) SmlPcdata_t(); |
|
345 } |
|
346 iMetInf->anchor->next->SetDataL(aValue); |
|
347 //_DBG_FILE("CNSmlDbMeta::SetAnchorNextL(): end"); |
|
348 } |
|
349 |
|
350 // ----------------------------------------------------------------------------- |
|
351 // CNSmlDbMeta::SetAnchorLastL |
|
352 // ----------------------------------------------------------------------------- |
|
353 // |
|
354 EXPORT_C void CNSmlDbMeta::SetAnchorLastL( const TDesC8& aValue ) |
|
355 { |
|
356 //_DBG_FILE("CNSmlDbMeta::SetAnchorLastL(): begin"); |
|
357 MakeSureMetInfExistsL(); |
|
358 if( !iMetInf->anchor ) |
|
359 { |
|
360 iMetInf->anchor = new (ELeave) sml_metinf_anchor_s(); |
|
361 } |
|
362 if( !iMetInf->anchor->last ) |
|
363 { |
|
364 iMetInf->anchor->last = new (ELeave) SmlPcdata_t(); |
|
365 } |
|
366 iMetInf->anchor->last->SetDataL(aValue); |
|
367 //_DBG_FILE("CNSmlDbMeta::SetAnchorLastL(): end"); |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CNSmlDbMeta::SetEmiL |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 EXPORT_C void CNSmlDbMeta::SetEmiL( const CDesC8Array& aValue ) |
|
375 { |
|
376 //_DBG_FILE("CNSmlDbMeta::SetVersionL(): begin"); |
|
377 MakeSureMetInfExistsL(); |
|
378 for( TInt i = 0; i < aValue.MdcaCount(); i++ ) |
|
379 { |
|
380 CXMLElement* e = AddPCDataL(&iMetInf->emi); |
|
381 e->SetDataL(aValue[i]); |
|
382 } |
|
383 //_DBG_FILE("CNSmlDbMeta::SetVersionL(): end"); |
|
384 } |
|
385 |
|
386 // ----------------------------------------------------------------------------- |
|
387 // CNSmlDbMeta::MakeSureMetInfExistsL |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 void CNSmlDbMeta::MakeSureMetInfExistsL() |
|
391 { |
|
392 //_DBG_FILE("CNSmlDbMeta::MakeSureMetInfExistsL(): begin"); |
|
393 if( !iMetInf ) |
|
394 { |
|
395 iMetInf = new (ELeave) sml_metinf_metinf_s(); |
|
396 } |
|
397 //_DBG_FILE("CNSmlDbMeta::MakeSureMetInfExistsL(): end"); |
|
398 } |
|
399 |
|
400 // End of File |