From: Steve Brokenshire Date: Sat, 13 Feb 2016 18:07:05 +0000 (+0000) Subject: Added remaining code for processing AUDIO of VALARM for CalendarEventObject. X-Git-Tag: release-0.02~369 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=9b77d3c0076254820ab869c23a689ef8d83a0e6b;p=xestiacalendar%2F.git Added remaining code for processing AUDIO of VALARM for CalendarEventObject. --- diff --git a/source/objects/calendarevent/CalendarEvent.cpp b/source/objects/calendarevent/CalendarEvent.cpp index 3e25e86..b12d6c9 100644 --- a/source/objects/calendarevent/CalendarEvent.cpp +++ b/source/objects/calendarevent/CalendarEvent.cpp @@ -1459,6 +1459,7 @@ void CalendarEventObject::ProcessData(){ ProcessAlarms(); int SeekCount = 0; + int AlarmObjectCount = 0; bool AlarmActionFound = false; @@ -1471,6 +1472,7 @@ void CalendarEventObject::ProcessData(){ bool AlarmActionFound = false; bool AlarmTriggerFound = false; + bool AlarmDurationFound = false; DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "ACTION"); @@ -1524,7 +1526,7 @@ void CalendarEventObject::ProcessData(){ // Process the data from TRIGGER. - DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "TRIGGER"); + DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "TRIGGER"); if (DataReceived.begin() != DataReceived.end()){ @@ -1567,11 +1569,77 @@ void CalendarEventObject::ProcessData(){ } NewAlarmData.TriggerData = DataReceived.begin()->second; + AlarmTriggerFound = true; + + } + + // Process data from DURATION. + + DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "DURATION"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + NewAlarmData.DurationTokens = DataReceived.begin()->first.substr(9); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + NewAlarmData.DurationData = DataReceived.begin()->second; + AlarmDurationFound = true; + + } + + // Process data from REPEAT. + + DataReceived = ProcessTextVectors(&EventAlarmName[SeekCount], &EventAlarmData[SeekCount], false, "REPEAT"); + + if (DataReceived.begin() != DataReceived.end() && AlarmDurationFound == true){ + + try { + NewAlarmData.RepeatTokens = DataReceived.begin()->first.substr(7); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + NewAlarmData.RepeatData = DataReceived.begin()->second; + + } else { + + NewAlarmData.DurationData.clear(); + NewAlarmData.DurationTokens.clear(); + + } + + // Process data from X-* + + AlarmObjectCount = 0; + + for(vector::iterator xtokeniter = EventAlarmName[SeekCount].begin(); + xtokeniter != EventAlarmName[SeekCount].end(); ++xtokeniter){ + + bool TokenData = false; + string PropertyTokens; + + if (xtokeniter->substr(0,2) == "X-" && + xtokeniter->size() > 2){ + + NewAlarmData.XTokensData.push_back(EventAlarmData[SeekCount][AlarmObjectCount]); + NewAlarmData.XTokensDataTokens.push_back(EventAlarmName[SeekCount][AlarmObjectCount]); + + } + + AlarmObjectCount++; } if (NewAlarmData.AlarmType == CALENDARALARM_AUDIO && - AlarmActionFound == true){ + AlarmActionFound == true && + AlarmTriggerFound == true){ CalendarAlarmData.push_back(NewAlarmData);