Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added code to process DAYLIGHT section in CalendarTimezoneObject
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 7 Feb 2016 11:58:09 +0000 (11:58 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 7 Feb 2016 11:58:09 +0000 (11:58 +0000)
source/objects/calendartimezone/CalendarTimezone.cpp

index a767cbf..f56ff83 100644 (file)
@@ -472,6 +472,307 @@ void CalendarTimezoneObject::ProcessData(){
                SeekCount++;
                        
        }
+
+       TZSeekCount = 0;
+       SeekCount = 0;
+       
+       for (vector<vector<string>>::iterator tzsiter = TimezoneDaylightName.begin();
+               tzsiter != TimezoneDaylightName.end(); tzsiter++){
+
+               bool DateTimeStartFound = false;
+               bool TimeZoneOffsetToFound = false;
+               bool TimeZoneOffsetFromFound = false;
+               
+               TimezoneDataStruct NewTZData;
+                                       
+               // Process the data from DTSTART.
+       
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                               &TimezoneDaylightData[SeekCount], false, "DTSTART");
+       
+               if (DataReceived.begin() != DataReceived.end()){
+       
+                       try {
+                               NewTZData.DateTimeStartTokens = DataReceived.begin()->first.substr(8);
+                       }
+               
+                       catch(const out_of_range &oor){
+                               // Do nothing as there is no data.
+                       }
+               
+                       NewTZData.DateTimeStartData = DataReceived.begin()->second;
+                       DateTimeStartFound = true;
+               
+               }
+                       
+               // Process the data from TZOFFSETFROM.
+                       
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                               &TimezoneDaylightData[SeekCount], false, "TZOFFSETFROM");
+       
+               if (DataReceived.begin() != DataReceived.end()){
+       
+                       try {
+                               NewTZData.TimeZoneOffsetFromTokens = DataReceived.begin()->first.substr(13);
+                       }
+               
+                       catch(const out_of_range &oor){
+                               // Do nothing as there is no data.
+                       }
+               
+                       NewTZData.TimeZoneOffsetFromData = DataReceived.begin()->second;
+                       TimeZoneOffsetFromFound = true;
+               
+               }
+                       
+               // Process the data from TZOFFSETTO.
+                       
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                               &TimezoneDaylightData[SeekCount], false, "TZOFFSETTO");
+       
+               if (DataReceived.begin() != DataReceived.end()){
+       
+                       try {
+                               NewTZData.TimeZoneOffsetToTokens = DataReceived.begin()->first.substr(11);
+                       }
+               
+                       catch(const out_of_range &oor){
+                               // Do nothing as there is no data.
+                       }
+               
+                       NewTZData.TimeZoneOffsetToData = DataReceived.begin()->second;
+                       TimeZoneOffsetToFound = true;
+               
+               }
+               
+               // Process the data from RRULE.
+
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                       &TimezoneDaylightData[SeekCount], false, "RRULE");
+       
+               if (DataReceived.begin() != DataReceived.end()){
+       
+                       try {
+                               NewTZData.RecurranceRuleDataTokens = DataReceived.begin()->first.substr(6);
+                       }
+               
+                       catch(const out_of_range &oor){
+                               // Do nothing as there is no data.
+                       }               
+                       
+                       NewTZData.RecurranceRuleData = DataReceived.begin()->second;
+               
+               }
+                       
+               // Process the data from COMMENT.
+       
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                       &TimezoneDaylightData[SeekCount], true, "COMMENT");
+
+               ObjectSeekCount = 0;
+       
+               for(multimap<string,string>::iterator propiter = DataReceived.begin(); 
+                       propiter != DataReceived.end(); 
+                       ++propiter){
+               
+                       NewTZData.CommentListTokens.push_back("");
+                       NewTZData.CommentListAltRep.push_back("");
+                       NewTZData.CommentListLanguage.push_back("");
+                       NewTZData.CommentList.push_back("");
+                       
+                       bool TokenData = false;
+                       string PropertyTokens;
+               
+                       PropertyNameData = (string*)&propiter->first;
+               
+                       PropertyData = SplitValues(*PropertyNameData);
+                       
+                       for(map<string,string>::iterator propdataiter = PropertyData.begin();
+                               propdataiter != PropertyData.end(); propdataiter++){
+                       
+                               if (propdataiter->first == "ALTREP"){
+                               
+                                       NewTZData.CommentListAltRep[ObjectSeekCount] = propdataiter->second;
+                               
+                               } else if (propdataiter->first == "LANGUAGE"){
+                               
+                                       NewTZData.CommentListLanguage[ObjectSeekCount] = propdataiter->second;
+                               
+                               } else {
+                               
+                                       if (TokenData == false){
+                                               TokenData = true;
+                                       } else {
+                                               PropertyTokens += ";";
+                                       }
+                               
+                                       PropertyTokens += propdataiter->first;
+                                       PropertyTokens += "=";
+                                       PropertyTokens += propdataiter->second;
+                               
+                               }
+                               
+                       }
+               
+                       if (PropertyTokens.size() > 0){
+                               NewTZData.CommentListTokens[ObjectSeekCount] = PropertyTokens;
+                       }
+                       
+                       NewTZData.CommentList[ObjectSeekCount] = propiter->second;
+                       
+                       ObjectSeekCount++;
+               
+               }
+               
+               // Process the data from RDATE.
+                       
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                       &TimezoneDaylightData[SeekCount], true, "RDATE");
+
+               ObjectSeekCount = 0;
+       
+               for(multimap<string,string>::iterator propiter = DataReceived.begin(); 
+                       propiter != DataReceived.end(); 
+                       ++propiter){
+               
+                       NewTZData.RecurranceDateDataTokens.push_back("");
+                       NewTZData.RecurranceDateDataValue.push_back("");
+                       NewTZData.RecurranceDateDataTimeZoneParam.push_back("");
+                       NewTZData.RecurranceDateData.push_back("");
+                       
+                       bool TokenData = false;
+                       string PropertyTokens;
+               
+                       PropertyNameData = (string*)&propiter->first;
+               
+                       PropertyData = SplitValues(*PropertyNameData);
+                       
+                       for(map<string,string>::iterator dataiter = PropertyData.begin();
+                               dataiter != PropertyData.end(); dataiter++){
+                       
+                               if (dataiter->first == "VALUE"){
+                       
+                                       NewTZData.RecurranceDateDataValue[ObjectSeekCount] = dataiter->second;
+                               
+                               } else if (dataiter->first == "TZID"){
+                               
+                                       NewTZData.RecurranceDateDataTimeZoneParam[ObjectSeekCount] = dataiter->second;
+                               
+                               } else {
+                               
+                                       if (TokenData == false){
+                                               TokenData = true;
+                                       } else {
+                                               PropertyTokens += ";";
+                                       }
+                               
+                                       PropertyTokens += dataiter->first;
+                                       PropertyTokens += "=";
+                                       PropertyTokens += dataiter->second;
+                               
+                               }
+                               
+                       }
+               
+                       if (PropertyTokens.size() > 0){
+                               NewTZData.RecurranceDateDataTokens[ObjectSeekCount] = PropertyTokens;
+                       }
+                       
+                       NewTZData.RecurranceDateData[ObjectSeekCount] = propiter->second;
+               
+                       ObjectSeekCount++;
+               
+               }
+                       
+               // Process the data from TZNAME.
+                       
+               DataReceived = ProcessTextVectors(&TimezoneDaylightName[SeekCount], 
+                       &TimezoneDaylightData[SeekCount], true, "TZNAME");
+
+               ObjectSeekCount = 0;
+       
+               for(multimap<string,string>::iterator propiter = DataReceived.begin(); 
+                       propiter != DataReceived.end(); 
+                       ++propiter){
+               
+                       NewTZData.TimeZoneNameTokens.push_back("");
+                       NewTZData.TimeZoneNameLanguage.push_back("");
+                       NewTZData.TimeZoneNameData.push_back("");
+                       
+                       bool TokenData = false;
+                       string PropertyTokens;
+               
+                       PropertyNameData = (string*)&propiter->first;
+               
+                       PropertyData = SplitValues(*PropertyNameData);
+                       
+                       for(map<string,string>::iterator dataiter = PropertyData.begin();
+                               dataiter != PropertyData.end(); dataiter++){
+                       
+                               if (dataiter->first == "LANGUAGE"){
+                               
+                                       NewTZData.TimeZoneNameLanguage[ObjectSeekCount] = dataiter->second;
+                               
+                               } else {
+                               
+                                       if (TokenData == false){
+                                               TokenData = true;
+                                       } else {
+                                               PropertyTokens += ";";
+                                       }
+                               
+                                       PropertyTokens += dataiter->first;
+                                       PropertyTokens += "=";
+                                       PropertyTokens += dataiter->second;
+                               
+                               }
+                               
+                       }
+               
+                       if (PropertyTokens.size() > 0){
+                               NewTZData.TimeZoneNameTokens[ObjectSeekCount] = PropertyTokens;
+                       }
+                       
+                       NewTZData.TimeZoneNameData[ObjectSeekCount] = propiter->second;
+               
+                       ObjectSeekCount++;
+               
+               }
+                       
+               ObjectSeekCount = 0;
+       
+               // Process data from X-*
+       
+               for(vector<string>::iterator propiter = TimezoneDaylightName[SeekCount].begin(); 
+                       propiter != TimezoneDaylightName[SeekCount].end(); ++propiter){
+               
+                       if (propiter->substr(0,2) == "X-" &&
+                               propiter->size() > 2){
+                                       
+                               NewTZData.XTokensData.push_back(TimezoneDaylightData[SeekCount][ObjectSeekCount]);
+                               NewTZData.XTokensDataTokens.push_back(TimezoneDaylightName[SeekCount][ObjectSeekCount]);
+                               
+                       }
+               
+                       ObjectSeekCount++;
+               
+               }
+               
+               // Check if the required values were given and
+               // insert NewTZData into the vector list of
+               // daylight timezones.
+                       
+               if (DateTimeStartFound == true &&
+                       TimeZoneOffsetToFound == true &&
+                       TimeZoneOffsetFromFound == true){
+                                       
+                       TimezoneDaylightCollection.push_back(NewTZData);
+                                       
+               }
+                       
+               SeekCount++;
+                       
+       }
        
 }
 
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy