|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // DST TZ Database Compiler |
|
15 // |
|
16 // |
|
17 |
|
18 #include "TzGlobals.h" |
|
19 #include "TzEntities.h" |
|
20 #include "TzTables.h" |
|
21 #include "TZNode.h" |
|
22 #include "TZDocument.h" |
|
23 #include "TzHelpers.h" |
|
24 #include <iostream> |
|
25 #include <fstream> |
|
26 #include <cstdio> |
|
27 #include <algorithm> |
|
28 using namespace std; |
|
29 //============================================================================ |
|
30 // CTzCpString::CTzCpString |
|
31 //============================================================================ |
|
32 CTzCpString::CTzCpString(CTZDocument& aDocument) |
|
33 : CPersistedEntityWrapper(aDocument) |
|
34 { |
|
35 } |
|
36 //============================================================================ |
|
37 // CTzCpString::ExternaliseL |
|
38 //============================================================================ |
|
39 void CTzCpString::ExternaliseL(ofstream& aFilestream) |
|
40 { |
|
41 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToStringTable; |
|
42 TUint8 stringLength = iString.length(); |
|
43 aFilestream.write((char*)&stringLength,sizeof(stringLength)); |
|
44 aFilestream << iString.c_str(); |
|
45 } |
|
46 //============================================================================ |
|
47 // CTzCpRegion::CTzCpRegion |
|
48 //============================================================================ |
|
49 CTzCpRegion::CTzCpRegion(CTZDocument& aDocument) |
|
50 : CPersistedEntityWrapper(aDocument) |
|
51 { |
|
52 iRegionalZonesIndex = new CTzCpRegionalZonesIndex(aDocument); |
|
53 } |
|
54 //============================================================================ |
|
55 // CTzCpRegion::~CTzCpRegion |
|
56 //============================================================================ |
|
57 CTzCpRegion::~CTzCpRegion() |
|
58 { |
|
59 for (int x = 0; x < iRegionalZonesIndex->iZoneIndex.size();++x) |
|
60 { |
|
61 iRegionalZonesIndex->iZoneIndex[x]->DecrRefCount(); |
|
62 } |
|
63 |
|
64 delete iRegionalZonesIndex; |
|
65 } |
|
66 |
|
67 //============================================================================ |
|
68 // CTzCpRegion::ExternaliseL |
|
69 //============================================================================ |
|
70 void CTzCpRegion::ExternaliseL(ofstream& aFilestream) |
|
71 { |
|
72 iPersistedEntity.iOffsetToRegionName = iRegionNameRef->iOffset; |
|
73 iPersistedEntity.iOffsetToRegionalZoneIndex = iRegionalZonesIndex->iOffset; |
|
74 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)); |
|
75 } |
|
76 //============================================================================ |
|
77 // CTzCpRuleUse::CTzCpRuleUse |
|
78 // RuleUse constructor. |
|
79 //============================================================================ |
|
80 CTzCpRuleUse::CTzCpRuleUse(CTZDocument& aDocument) |
|
81 : CPersistedEntityWrapper(aDocument) |
|
82 { |
|
83 } |
|
84 //============================================================================ |
|
85 // CTzCpRuleUse::~CTzCpRuleUse |
|
86 //============================================================================ |
|
87 CTzCpRuleUse::~CTzCpRuleUse() |
|
88 { |
|
89 iRuleLetterPtr->DecrRefCount(); |
|
90 iRuleDefinitionPtr->DecrRefCount(); |
|
91 } |
|
92 //============================================================================ |
|
93 // CTzCpRuleUse::AssembleL |
|
94 // Populates the CTzCpRuleUse from the current node. |
|
95 // RuleUse 'To' field may contain 'only' in the olsen files |
|
96 // This is to show the rule was in use for that year only. In this case |
|
97 // we change the to field to match the from field. |
|
98 //============================================================================ |
|
99 void CTzCpRuleUse::AssembleL(CTZNode& aNode) |
|
100 { |
|
101 iPersistedEntity.iFromYear = atoi(aNode.NodeList()[2]->iValue.c_str()); |
|
102 if (aNode.NodeList()[3]->iValue.c_str()[0] == 'o') |
|
103 { |
|
104 iPersistedEntity.iUntilYear = iPersistedEntity.iFromYear; |
|
105 } |
|
106 else if (aNode.NodeList()[3]->iValue.c_str()[0] == 'm') |
|
107 { |
|
108 iPersistedEntity.iUntilYear = KMaxTUint16; |
|
109 } |
|
110 else |
|
111 { |
|
112 iPersistedEntity.iUntilYear = atoi(aNode.NodeList()[3]->iValue.c_str()); |
|
113 } |
|
114 } |
|
115 //============================================================================ |
|
116 // CTzCpLink::CTzCpLink |
|
117 //============================================================================ |
|
118 CTzCpLink::CTzCpLink(CTZDocument& aDocument) |
|
119 : CPersistedEntityWrapper(aDocument) |
|
120 { |
|
121 } |
|
122 //============================================================================ |
|
123 // CTzCpLink::AssembleL |
|
124 //============================================================================ |
|
125 int CTzCpLink::AssembleL(CTZNode& aNode) |
|
126 { |
|
127 //Add the from value into the string table as is |
|
128 //aNode.iNodeList[ELinkFormatFromZone]->iValue; |
|
129 //Split the 'To' value into its region/zone parts |
|
130 //'Region' is first part of a zone identity. eg 'Europe' in 'Europe/London' |
|
131 //'Zone' is second part of a zone identity. eg 'London' in 'Europe/London' |
|
132 string linkString = aNode.NodeList()[ELinkFormatToZone]->iValue; |
|
133 string fromString = aNode.NodeList()[ELinkFormatFromZone]->iValue; |
|
134 int slashChar = linkString.find('/',0); |
|
135 iLinkString = &iDocument.StringTable()->AddString(fromString); |
|
136 iLinkString->IncrRefCount(); |
|
137 |
|
138 if (slashChar > 0) |
|
139 { |
|
140 iRegionString = &iDocument.StringTable()->AddString(linkString.substr(0,slashChar)); |
|
141 } |
|
142 else |
|
143 { |
|
144 iRegionString = &iDocument.StringTable()->AddString(""); |
|
145 } |
|
146 iRegionString->IncrRefCount(); |
|
147 |
|
148 iZoneString = &iDocument.StringTable()->AddString(linkString.substr(slashChar+1)); |
|
149 iZoneString->IncrRefCount(); |
|
150 return 0; |
|
151 } |
|
152 //============================================================================ |
|
153 // CTzCpLink::ExternaliseL |
|
154 //============================================================================ |
|
155 void CTzCpLink::ExternaliseL(ofstream& aFilestream) |
|
156 { |
|
157 iPersistedEntity.iOffsetToLinkName = iLinkString->iOffset; |
|
158 iPersistedEntity.iOffsetToZone = iLinkedZoneOffset->iOffset; |
|
159 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)); |
|
160 } |
|
161 //============================================================================ |
|
162 // CTzCpRuleUse::ExternaliseL |
|
163 //============================================================================ |
|
164 void CTzCpRuleUse::ExternaliseL(ofstream& aFilestream) |
|
165 { |
|
166 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToRuleUsesTable; |
|
167 iPersistedEntity.iOffsetToRuleDefinition = iRuleDefinitionPtr->iOffset; |
|
168 iPersistedEntity.iOffsetToRuleLetterString = iRuleLetterPtr->iOffset; |
|
169 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)); |
|
170 } |
|
171 //============================================================================ |
|
172 // CTzCpRuleDefinition::CTzCpRuleDefinition |
|
173 //============================================================================ |
|
174 CTzCpRuleDefinition::CTzCpRuleDefinition(CTZDocument& aDocument) |
|
175 : CPersistedEntityWrapper(aDocument) |
|
176 { |
|
177 } |
|
178 //============================================================================ |
|
179 // CTzCpRuleDefinition::AssembleL |
|
180 // Populates the CTzCpRuleDefinition from the current node |
|
181 //============================================================================ |
|
182 int CTzCpRuleDefinition::AssembleL(CTZNode& aNode) |
|
183 { |
|
184 //Set the time offset |
|
185 //Assuming that the 'SAVE' field in a rule is of the format H:MM |
|
186 string tmpString = aNode.NodeList()[ERuleFormatSave]->iValue; |
|
187 int breakAt = tmpString.find_first_of(':'); |
|
188 int hours = atoi(tmpString.c_str()); |
|
189 int minutes = 0; |
|
190 if (tmpString.length() > 1) |
|
191 { |
|
192 minutes = atoi(tmpString.substr(2).c_str()); |
|
193 } |
|
194 iPersistedEntity.iStdTimeOffset = (hours*60) + minutes; |
|
195 |
|
196 //Set the month ( 0 - 11) |
|
197 iPersistedEntity.iMonth = CTzCpHelpers::GetMonth(aNode.NodeList()[ERuleFormatIn]->iValue); |
|
198 |
|
199 //Set the day rule |
|
200 tmpString = aNode.NodeList()[ERuleFormatOn]->iValue; |
|
201 string searchDayAfterString = ">="; |
|
202 string searchDayBeforeString = "<="; |
|
203 |
|
204 if (tmpString.c_str()[0] == 'l') |
|
205 { |
|
206 iPersistedEntity.iDayRule = ETzDayInLastWeekOfMonth; |
|
207 } |
|
208 else if (strstr(tmpString.c_str(),searchDayAfterString.c_str()) != NULL) |
|
209 { |
|
210 iPersistedEntity.iDayRule = ETzDayAfterDate; |
|
211 } |
|
212 else if (strstr(tmpString.c_str(),searchDayBeforeString.c_str()) != NULL) |
|
213 { |
|
214 iPersistedEntity.iDayRule = ETzDayBeforeDate; |
|
215 } |
|
216 else |
|
217 { |
|
218 iPersistedEntity.iDayRule = ETzFixedDate; |
|
219 } |
|
220 |
|
221 //Set the day of month. This is only required if the day rule is |
|
222 //ETzFixedDate, EDayBeforeDate or EDayAfterDate. Defaults to 0. |
|
223 TInt tmpDay; |
|
224 switch (iPersistedEntity.iDayRule) |
|
225 { |
|
226 case ETzFixedDate: |
|
227 tmpDay = atoi(tmpString.c_str()); |
|
228 tmpDay = tmpDay ? tmpDay-1 : 0; // OG: zero-based Day (as used in TDateTime in Symbian OS) |
|
229 iPersistedEntity.iDayOfMonth = tmpDay; |
|
230 break; |
|
231 case ETzDayBeforeDate: |
|
232 case ETzDayAfterDate: |
|
233 tmpDay = atoi(tmpString.substr(5).c_str()); |
|
234 tmpDay = tmpDay ? tmpDay-1 : 0; // OG: zero-based Day (as used in TDateTime in Symbian OS) |
|
235 iPersistedEntity.iDayOfMonth = tmpDay; |
|
236 break; |
|
237 default: |
|
238 iPersistedEntity.iDayOfMonth = 0; |
|
239 break; |
|
240 } |
|
241 |
|
242 //Set the day of the week. This only applies if day rule != ETzFixedDate |
|
243 iPersistedEntity.iDayOfWeek = CTzCpHelpers::GetDay(tmpString); |
|
244 |
|
245 //Set the time of change (in minutes) |
|
246 tmpString = aNode.NodeList()[ERuleFormatAt]->iValue; |
|
247 iPersistedEntity.iTimeOfChange = CTzCpHelpers::GetTimeOfDayInMinutes(tmpString); |
|
248 |
|
249 //set the time reference |
|
250 iPersistedEntity.iTimeReference = CTzCpHelpers::GetTimeReference(tmpString); |
|
251 |
|
252 //Spare flags - these will probably be used for implementing write access |
|
253 //if required |
|
254 //iPersistedEntity.iReferenceCount = 0; //Unused for now |
|
255 //iPersistedEntity.iStatus = 0; //Unused for now |
|
256 return 0; |
|
257 } |
|
258 //============================================================================ |
|
259 // CTzCpRuleDefinition::ExternaliseL |
|
260 //============================================================================ |
|
261 void CTzCpRuleDefinition::ExternaliseL(ofstream& aFilestream) |
|
262 { |
|
263 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToRuleDefinitionsTable; |
|
264 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)); |
|
265 } |
|
266 //============================================================================ |
|
267 // CTzCpRuleSet::CTzCpRuleSet |
|
268 //============================================================================ |
|
269 CTzCpRuleSet::CTzCpRuleSet(CTZDocument& aDocument,std::string aRuleSetName) |
|
270 : CPersistedEntityWrapper(aDocument) , iName(aRuleSetName) |
|
271 { |
|
272 } |
|
273 //============================================================================ |
|
274 // CTzCpRuleSet::~CTzCpRuleSet |
|
275 //============================================================================ |
|
276 CTzCpRuleSet::~CTzCpRuleSet() |
|
277 { |
|
278 int size = RuleUses().size(); |
|
279 for (int x = 0; x < size;x++) |
|
280 { |
|
281 iVector[x]->DecrRefCount(); |
|
282 } |
|
283 } |
|
284 |
|
285 //============================================================================ |
|
286 // CTzCpRuleSet::ExternaliseL |
|
287 //============================================================================ |
|
288 void CTzCpRuleSet::ExternaliseL(ofstream& aFilestream) |
|
289 { |
|
290 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToRuleSetsTable; |
|
291 iPersistedEntity.iNumberOfRuleUses = iVector.size(); |
|
292 |
|
293 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)-sizeof(iPersistedEntity.iOffsetsToRuleUses)); |
|
294 TUint16 ruleUseOffset; |
|
295 for (int x = 0; x < iPersistedEntity.iNumberOfRuleUses;x++) |
|
296 { |
|
297 ruleUseOffset = iVector[x]->iOffset; |
|
298 aFilestream.write((char*)&ruleUseOffset,sizeof(ruleUseOffset)); |
|
299 } |
|
300 } |
|
301 //============================================================================ |
|
302 // CTzCpRuleSet::AddRuleUse |
|
303 // Adds the index of the CTzCpRuleUse in the rule use table |
|
304 // to the collection of rule uses |
|
305 //============================================================================ |
|
306 void CTzCpRuleSet::AddRuleUse(CTzCpRuleUse& aRuleUse) |
|
307 { |
|
308 iVector.push_back(&aRuleUse); //The address of the ruleuse |
|
309 } |
|
310 //============================================================================ |
|
311 // CTzCpRegionalZonesIndex::CTzCpRegionalZoneIndex |
|
312 //============================================================================ |
|
313 CTzCpRegionalZonesIndex::CTzCpRegionalZonesIndex(CTZDocument& aDocument) |
|
314 : CPersistedEntityWrapper(aDocument) |
|
315 { |
|
316 } |
|
317 |
|
318 //============================================================================ |
|
319 // CTzCpRegionalZonesIndex::ExternaliseL |
|
320 //============================================================================ |
|
321 void CTzCpRegionalZonesIndex::ExternaliseL(ofstream& aFilestream) |
|
322 { |
|
323 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToRegionalZonesTable; |
|
324 |
|
325 // sort zone index alphabetically before externalising it |
|
326 sort(iZoneIndex.begin(),iZoneIndex.end(),CTzCpZone::SZoneNameSort()); |
|
327 |
|
328 iPersistedEntity.iNumberOfZones = iZoneIndex.size(); |
|
329 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity) - sizeof(iPersistedEntity.iOffsetsToZones)); |
|
330 //Write out the zone offsets |
|
331 for (int x = 0; x < iPersistedEntity.iNumberOfZones;x++) |
|
332 { |
|
333 TUint16 zoneOffset = iZoneIndex[x]->iOffset; |
|
334 aFilestream.write((char*)&zoneOffset,sizeof(zoneOffset)); |
|
335 } |
|
336 } |
|
337 //============================================================================ |
|
338 // CTzCpRegionalZonesIndex::AddZoneIndex |
|
339 // We add the address of the reference to avoid a double deletion - |
|
340 // this zone will already |
|
341 //============================================================================ |
|
342 void CTzCpRegionalZonesIndex::AddZoneIndex(CTzCpZone& aZoneRef) |
|
343 { |
|
344 iZoneIndex.push_back(&aZoneRef); |
|
345 } |
|
346 //============================================================================ |
|
347 // CTzCpZone::CTzCpZone |
|
348 //============================================================================ |
|
349 CTzCpZone::CTzCpZone(CTZDocument& aDocument) |
|
350 : CPersistedEntityWrapper(aDocument) |
|
351 { |
|
352 } |
|
353 //============================================================================ |
|
354 // CTzCpZone::~CTzCpZone |
|
355 // When we destroy a zone, we need to decrement all its referenced entity |
|
356 // reference counts by 1. |
|
357 //============================================================================ |
|
358 CTzCpZone::~CTzCpZone() |
|
359 { |
|
360 iRegionNameRef->DecrRefCount(); |
|
361 iZoneNameRef->DecrRefCount(); |
|
362 |
|
363 for (int x = 0; x < iTimeAlignments.size();++x) |
|
364 { |
|
365 iTimeAlignments[x]->DecrRefCount(); |
|
366 } |
|
367 } |
|
368 |
|
369 //============================================================================ |
|
370 // CTzCpZone::ExternaliseL |
|
371 //============================================================================ |
|
372 void CTzCpZone::ExternaliseL(ofstream& aFilestream) |
|
373 { |
|
374 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToZones; |
|
375 iPersistedEntity.iLocationId = iLocationId; |
|
376 iPersistedEntity.iOffsetToZoneName = iZoneNameRef->iOffset; |
|
377 iPersistedEntity.iOffsetToRegionName = iRegionNameRef->iOffset; |
|
378 iPersistedEntity.iNumberOfStdTimeAlignments = iTimeAlignments.size(); |
|
379 |
|
380 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)-sizeof(iPersistedEntity.iOffsetsToTimeAlignments)); |
|
381 |
|
382 //Externalise the time alignment offsets |
|
383 for (int x = 0; x < iPersistedEntity.iNumberOfStdTimeAlignments; x++) |
|
384 { |
|
385 TUint16 stdoffset = iTimeAlignments[x]->iOffset; |
|
386 aFilestream.write((char*)&stdoffset,sizeof(stdoffset)); |
|
387 } |
|
388 } |
|
389 //============================================================================ |
|
390 // CTzCpStdTimeAlignment::CTzCpStdTimeAlignment |
|
391 //============================================================================ |
|
392 CTzCpStdTimeAlignment::CTzCpStdTimeAlignment(CTZDocument& aDocument) |
|
393 : CPersistedEntityWrapper(aDocument) |
|
394 { |
|
395 } |
|
396 //============================================================================ |
|
397 // CTzCpStdTimeAlignment::~CTzCpStdTimeAlignment |
|
398 // When we destroy a CTzCpStdTimeAlignment we need to decrement all its |
|
399 // referenced entity reference counts by 1. |
|
400 //============================================================================ |
|
401 CTzCpStdTimeAlignment::~CTzCpStdTimeAlignment() |
|
402 { |
|
403 iOffsetToTimeZoneFormatName->DecrRefCount(); |
|
404 |
|
405 for (int x = 0; x < iOffsetsToTimeZonesShortNames.size();++x) |
|
406 { |
|
407 iOffsetsToTimeZonesShortNames[x]->DecrRefCount(); |
|
408 } |
|
409 iRuleSet->DecrRefCount(); |
|
410 } |
|
411 //============================================================================ |
|
412 // CTzCpStdTimeAlignment::AssembleL |
|
413 // Populates the CTzCpStdTimeAlignment from the current node |
|
414 //============================================================================ |
|
415 int CTzCpStdTimeAlignment::AssembleL(CTZNode& aNode) |
|
416 { |
|
417 string tmpString; |
|
418 //Until Year |
|
419 if (EZoneFormatUntilYear >= aNode.NodeList().size()) |
|
420 { |
|
421 iPersistedEntity.iUntilYear = KMaxYear; |
|
422 } |
|
423 else |
|
424 { |
|
425 iPersistedEntity.iUntilYear = atoi(aNode.NodeList()[EZoneFormatUntilYear]->iValue.c_str()); |
|
426 } |
|
427 //Until Month |
|
428 if (EZoneFormatUntilMonth >= aNode.NodeList().size()) |
|
429 { |
|
430 iPersistedEntity.iUntilMonth = 0; |
|
431 } |
|
432 else |
|
433 { |
|
434 tmpString = aNode.NodeList()[EZoneFormatUntilMonth]->iValue; |
|
435 if (tmpString.empty()) |
|
436 iPersistedEntity.iUntilMonth = 0; |
|
437 else |
|
438 iPersistedEntity.iUntilMonth = CTzCpHelpers::GetMonth(tmpString); |
|
439 } |
|
440 //Until DayOfMonth |
|
441 if (EZoneFormatUntilDay >= aNode.NodeList().size()) |
|
442 { |
|
443 iPersistedEntity.iUntilDayOfMonth = 0; |
|
444 } |
|
445 else |
|
446 { |
|
447 tmpString = aNode.NodeList()[EZoneFormatUntilDay]->iValue; |
|
448 TInt tmpDay = atoi(aNode.NodeList()[EZoneFormatUntilDay]->iValue.c_str()); |
|
449 tmpDay = tmpDay ? tmpDay-1 : 0; // zero-based Day (as used in TDateTime in Symbian OS) |
|
450 iPersistedEntity.iUntilDayOfMonth = tmpDay; |
|
451 } |
|
452 //Until minutes |
|
453 //Until Time Reference |
|
454 if (EZoneFormatUntilMinutes >= aNode.NodeList().size()) |
|
455 { |
|
456 iPersistedEntity.iUntilTimeInMinutes = 0; |
|
457 iPersistedEntity.iUntilTimeReference = 0; |
|
458 } |
|
459 else |
|
460 { |
|
461 tmpString = aNode.NodeList()[EZoneFormatUntilMinutes]->iValue; |
|
462 iPersistedEntity.iUntilTimeInMinutes = CTzCpHelpers::GetTimeOfDayInMinutes(tmpString); |
|
463 iPersistedEntity.iUntilTimeReference = CTzCpHelpers::GetTimeReference(tmpString); |
|
464 } |
|
465 //GMTOffset in minutes |
|
466 tmpString = aNode.NodeList()[EZoneFormatGMTOffset]->iValue; |
|
467 iPersistedEntity.iUtcOffset = CTzCpHelpers::GetTimeOfDayInMinutes(tmpString); |
|
468 |
|
469 //Set these in the document after completion. |
|
470 //Offset to ruleset |
|
471 iPersistedEntity.iOffsetToRuleSet = 0; |
|
472 //offset to timezoneformat |
|
473 iPersistedEntity.iOffsetToTimeZoneFormatName = 0; |
|
474 return 0; |
|
475 } |
|
476 //============================================================================ |
|
477 // CTzCpStdTimeAlignment::ExternaliseL |
|
478 //============================================================================ |
|
479 void CTzCpStdTimeAlignment::ExternaliseL(ofstream& aFilestream) |
|
480 { |
|
481 iOffset = (int)aFilestream.tellp() - iDocument.DbHeader()->iOffsetToStdTimeAlignmentsTable; |
|
482 //Retrieve the ruleset offset |
|
483 iPersistedEntity.iOffsetToRuleSet = iRuleSet->iOffset; |
|
484 //Retrieve the time zone format name offset |
|
485 iPersistedEntity.iOffsetToTimeZoneFormatName = iDocument.StringTable()->Strings()[iPersistedEntity.iOffsetToTimeZoneFormatName]->iOffset; |
|
486 //Set the number of time zones |
|
487 iPersistedEntity.iNumberOfTimeZones = iOffsetsToTimeZonesShortNames.size(); |
|
488 |
|
489 aFilestream.write((char*)&iPersistedEntity,sizeof(iPersistedEntity)-sizeof(iPersistedEntity.iOffsetsToTimeZones)); |
|
490 //Write the time zone offsets |
|
491 int size = iOffsetsToTimeZonesShortNames.size(); |
|
492 for (int x = 0; x < size; x++) |
|
493 { |
|
494 TUint16 offsetToTimeZone = iOffsetsToTimeZonesShortNames[x]->iOffset; |
|
495 aFilestream.write((char*)&offsetToTimeZone,sizeof(offsetToTimeZone)); |
|
496 } |
|
497 } |
|
498 //============================================================================ |
|
499 // End of file |
|
500 //============================================================================ |