1 #include "CalendarFreeBusy.h"
5 CalendarObjectValidResult CalendarFreeBusyObject::ValidObject(){
7 bool ValidBegin = false;
9 bool ValidDateTimeStamp = false;
10 bool ValidUniqueID = false;
11 bool ValidDateTimeStart = false;
15 // Look for BEGIN:VFREEBUSY.
17 for (vector<string>::iterator iter = ObjectName.begin();
18 iter != ObjectName.end(); iter++){
20 if (ObjectName[SeekCount] == "BEGIN" &&
21 ObjectData[SeekCount] == "VFREEBUSY"){
23 if (ValidBegin == false){
26 return CALENDAROBJECTVALID_INVALIDFORMAT;
31 if (ObjectName[SeekCount] == "END" &&
32 ObjectData[SeekCount] == "VFREEBUSY" &&
35 return CALENDAROBJECTVALID_INVALIDFORMAT;
47 for (vector<string>::iterator iter = ObjectName.begin();
48 iter != ObjectName.end(); iter++){
51 PropertyName = ObjectName[SeekCount].substr(0,7);
54 catch(const out_of_range& oor){
58 if (PropertyName == "DTSTAMP"){
60 if (ValidDateTimeStamp == false){
61 ValidDateTimeStamp = true;
63 return CALENDAROBJECTVALID_INVALIDFORMAT;
76 for (vector<string>::iterator iter = ObjectName.begin();
77 iter != ObjectName.end(); iter++){
80 PropertyName = ObjectName[SeekCount].substr(0,3);
83 catch(const out_of_range& oor){
87 if (PropertyName == "UID"){
89 if (ValidUniqueID == false){
92 return CALENDAROBJECTVALID_INVALIDFORMAT;
103 // Look for END:VFREEBUSY.
105 for (vector<string>::iterator iter = ObjectName.begin();
106 iter != ObjectName.end(); iter++){
108 if (ObjectName[SeekCount] == "END" &&
109 ObjectData[SeekCount] == "VFREEBUSY"){
111 if (ValidEnd == false){
114 return CALENDAROBJECTVALID_INVALIDFORMAT;
123 // Check if the VEVENT is valid.
125 if (ValidBegin == true &&
127 ValidDateTimeStamp == true &&
128 ValidUniqueID == true){
130 return CALENDAROBJECTVALID_OK;
134 return CALENDAROBJECTVALID_INVALIDFORMAT;
140 void CalendarFreeBusyObject::ProcessData(){
144 multimap<string,string> DataReceived;
145 map<string,string> PropertyData;
146 string *PropertyNameData = nullptr;
147 int ObjectSeekCount = 0;