bool ValidEnd = false;
bool ValidDateTimeStamp = false;
bool ValidUniqueID = false;
+ bool ValidDateTimeStart = false;
int SeekCount = 0;
+ string PropertyName;
// Look for BEGIN:VEVENT.
for (vector<string>::iterator iter = ObjectName.begin();
iter != ObjectName.end(); iter++){
-
- if (ObjectName[SeekCount] == "DTSTAMP"){
+
+ try{
+ PropertyName = ObjectName[SeekCount].substr(0,7);
+ }
+
+ catch(const out_of_range& oor){
+ continue;
+ }
+
+ if (PropertyName == "DTSTAMP"){
if (ValidDateTimeStamp == false){
ValidDateTimeStamp = true;
for (vector<string>::iterator iter = ObjectName.begin();
iter != ObjectName.end(); iter++){
- if (ObjectName[SeekCount] == "UID"){
+ try{
+ PropertyName = ObjectName[SeekCount].substr(0,3);
+ }
+
+ catch(const out_of_range& oor){
+ continue;
+ }
+
+ if (PropertyName == "UID"){
if (ValidUniqueID == false){
ValidUniqueID = true;
SeekCount = 0;
+ // Look for DTSTART.
+
+ for (vector<string>::iterator iter = ObjectName.begin();
+ iter != ObjectName.end(); iter++){
+
+ try{
+ PropertyName = ObjectName[SeekCount].substr(0,7);
+ }
+
+ catch(const out_of_range& oor){
+ continue;
+ }
+
+ if (PropertyName == "DTSTART"){
+
+ if (ValidDateTimeStart == false){
+ ValidDateTimeStart = true;
+ } else {
+ return CALENDAROBJECTVALID_INVALIDFORMAT;
+ }
+
+ }
+
+ SeekCount++;
+
+ }
+
+ SeekCount = 0;
+
// Look for END:VEVENT.
for (vector<string>::iterator iter = ObjectName.begin();
if (ValidBegin == true &&
ValidEnd == true &&
ValidDateTimeStamp == true &&
+ ValidDateTimeStart == true &&
ValidUniqueID == true){
return CALENDAROBJECTVALID_OK;
// Process the data.
+ multimap<string,string> DataReceived;
+
+ // Get the Date Time Stamp (DTSTAMP).
+
+ DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "DTSTAMP");
+
+ // Process the data from DTSTAMP.
+
+ if (DataReceived.begin() != DataReceived.end()){
+
+ try {
+ DateTimeStampTokens = DataReceived.begin()->first.substr(8);
+ }
+
+ catch(const out_of_range &oor){
+ // Do nothing as there is no data.
+ }
+
+ DateTimeStampData = DataReceived.begin()->second;
+
+ }
+
+ // Get the Unique ID (UID).
+
+ DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "UID");
+
+ // Process the data from DTSTAMP.
+
+ if (DataReceived.begin() != DataReceived.end()){
+
+ try {
+ UniqueIDTokens = DataReceived.begin()->first.substr(4);
+ }
+
+ catch(const out_of_range &oor){
+ // Do nothing as there is no data.
+ }
+
+ UniqueID = DataReceived.begin()->second;
+
+ }
+
}