From f41a63030bda80c3cb1a902e8c292ccc9973816a Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 31 Jan 2016 13:09:50 +0000 Subject: [PATCH] Added code to process DUE and DURATION in CalendarTaskObject. --- source/objects/calendartask/CalendarTask.cpp | 75 ++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/source/objects/calendartask/CalendarTask.cpp b/source/objects/calendartask/CalendarTask.cpp index 36e44a3..6c082ab 100644 --- a/source/objects/calendartask/CalendarTask.cpp +++ b/source/objects/calendartask/CalendarTask.cpp @@ -737,4 +737,79 @@ void CalendarTaskObject::ProcessData(){ } + bool DueProcessed = false; + + // Process the data from DUE. + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DUE"); + + if (DataReceived.begin() != DataReceived.end()){ + + bool TokenData = false; + string PropertyTokens; + + PropertyNameData = (string*)&DataReceived.begin()->first; + + PropertyData = SplitValues(*PropertyNameData); + + for(map::iterator iter = PropertyData.begin(); + iter != PropertyData.end(); iter++){ + + if (iter->first == "TZID"){ + + DueDataTimeZoneID = iter->second; + + } else if (iter->first == "VALUE"){ + + DueDataValue = iter->second; + + } else { + + if (TokenData == false){ + TokenData = true; + } else { + PropertyTokens += ";"; + } + + PropertyTokens += iter->first; + PropertyTokens += "="; + PropertyTokens += iter->second; + + } + + } + + if (PropertyTokens.size() > 0){ + + DueDataTokens = PropertyTokens; + + } + + DueData = DataReceived.begin()->second; + DueProcessed = true; + + } + + // If there is no DUE, then check for DURATION. + + if (DueProcessed == false){ + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DURATION"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + DurationDataTokens = DataReceived.begin()->first.substr(9); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + DurationData = DataReceived.begin()->second; + + } + + } + } \ No newline at end of file -- 2.39.5