Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added initial version of the CalendarFreeBusyObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 31 Jan 2016 17:23:12 +0000 (17:23 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 31 Jan 2016 17:23:12 +0000 (17:23 +0000)
source/objects/calendarfreebusy/CalendarFreeBusy.cpp [new file with mode: 0644]
source/objects/calendarfreebusy/CalendarFreeBusy.h [new file with mode: 0644]

diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy.cpp b/source/objects/calendarfreebusy/CalendarFreeBusy.cpp
new file mode 100644 (file)
index 0000000..5e729bc
--- /dev/null
@@ -0,0 +1,149 @@
+#include "CalendarFreeBusy.h"
+
+using namespace std;
+
+CalendarObjectValidResult CalendarFreeBusyObject::ValidObject(){
+       bool ValidBegin = false;
+       bool ValidEnd = false;
+       bool ValidDateTimeStamp = false;
+       bool ValidUniqueID = false;
+       bool ValidDateTimeStart = false;
+       int SeekCount = 0;
+       string PropertyName;
+       
+       // Look for BEGIN:VFREEBUSY.
+       
+       for (vector<string>::iterator iter = ObjectName.begin();
+               iter != ObjectName.end(); iter++){
+       
+               if (ObjectName[SeekCount] == "BEGIN" &&
+                       ObjectData[SeekCount] == "VFREEBUSY"){
+                       
+                       if (ValidBegin == false){
+                               ValidBegin = true;
+                       } else {
+                               return CALENDAROBJECTVALID_INVALIDFORMAT;
+                       }
+                               
+               }
+               
+               if (ObjectName[SeekCount] == "END" &&
+                       ObjectData[SeekCount] == "VFREEBUSY" &&
+                       ValidBegin == false){
+               
+                       return CALENDAROBJECTVALID_INVALIDFORMAT;
+                               
+               }
+               
+               SeekCount++;
+                       
+       }
+       
+       SeekCount = 0;
+       
+       // Look for DTSTAMP.
+       
+       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 == "DTSTAMP"){
+                       
+                       if (ValidDateTimeStamp == false){
+                               ValidDateTimeStamp = true;
+                       } else {
+                               return CALENDAROBJECTVALID_INVALIDFORMAT;
+                       }
+                               
+               }
+                       
+               SeekCount++;
+                       
+       }
+       
+       SeekCount = 0;
+       
+       // Look for UID.
+       
+       for (vector<string>::iterator iter = ObjectName.begin();
+               iter != ObjectName.end(); iter++){
+       
+               try{
+                       PropertyName = ObjectName[SeekCount].substr(0,3);
+               }
+               
+               catch(const out_of_range& oor){
+                       continue;
+               }
+                       
+               if (PropertyName == "UID"){
+                       
+                       if (ValidUniqueID == false){
+                               ValidUniqueID = true;
+                       } else {
+                               return CALENDAROBJECTVALID_INVALIDFORMAT;
+                       }
+                               
+               }
+                       
+               SeekCount++;
+                       
+       }
+       
+       SeekCount = 0;
+       
+       // Look for END:VFREEBUSY.
+       
+       for (vector<string>::iterator iter = ObjectName.begin();
+               iter != ObjectName.end(); iter++){
+       
+               if (ObjectName[SeekCount] == "END" &&
+                       ObjectData[SeekCount] == "VFREEBUSY"){
+                       
+                       if (ValidEnd == false){
+                               ValidEnd = true;
+                       } else {
+                               return CALENDAROBJECTVALID_INVALIDFORMAT;
+                       }
+                               
+               }
+                       
+               SeekCount++;
+                       
+       }
+       
+       // Check if the VEVENT is valid.
+
+       if (ValidBegin == true && 
+               ValidEnd == true && 
+               ValidDateTimeStamp == true &&
+               ValidUniqueID == true){
+               
+               return CALENDAROBJECTVALID_OK;
+                       
+       } else {
+               
+               return CALENDAROBJECTVALID_INVALIDFORMAT;
+               
+       }
+       
+}
+
+void CalendarFreeBusyObject::ProcessData(){
+       
+       // Process the data.
+       
+       multimap<string,string> DataReceived;
+       map<string,string> PropertyData;
+       string *PropertyNameData = nullptr;
+       int ObjectSeekCount = 0;
+       
+}
\ No newline at end of file
diff --git a/source/objects/calendarfreebusy/CalendarFreeBusy.h b/source/objects/calendarfreebusy/CalendarFreeBusy.h
new file mode 100644 (file)
index 0000000..3906e9c
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __OBJECTS_CALENDARFREEBUSY_CALENDARFREEBUSY_H__
+#define __OBJECTS_CALENDARFREEBUSY_CALENDARFREEBUSY_H__
+
+#include "../calendarobject/CalendarObject.h"
+
+class CalendarFreeBusyObject: public CalendarObject{
+  
+       CalendarObjectValidResult ValidObject();
+       
+       private:
+       
+       void ProcessData();
+       
+};
+
+#endif
\ No newline at end of file
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