Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Setup the initial version of CalendarJournalObject.
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 31 Jan 2016 14:08:44 +0000 (14:08 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 31 Jan 2016 14:08:44 +0000 (14:08 +0000)
source/objects/calendarjournal/CalendarJournal.cpp [new file with mode: 0644]
source/objects/calendarjournal/CalendarJournal.h [new file with mode: 0644]

diff --git a/source/objects/calendarjournal/CalendarJournal.cpp b/source/objects/calendarjournal/CalendarJournal.cpp
new file mode 100644 (file)
index 0000000..f3c66c7
--- /dev/null
@@ -0,0 +1,148 @@
+#include "CalendarJournal.h"
+
+using namespace std;
+
+CalendarObjectValidResult CalendarJournalObject::ValidObject(){
+
+       bool ValidBegin = false;
+       bool ValidEnd = false;
+       bool ValidDateTimeStamp = false;
+       bool ValidUniqueID = false;
+       int SeekCount = 0;
+       string PropertyName;
+       
+       // Look for BEGIN:VJOURNAL.
+       
+       for (vector<string>::iterator iter = ObjectName.begin();
+               iter != ObjectName.end(); iter++){
+       
+               if (ObjectName[SeekCount] == "BEGIN" &&
+                       ObjectData[SeekCount] == "VJOURNAL"){
+                       
+                       if (ValidBegin == false){
+                               ValidBegin = true;
+                       } else {
+                               return CALENDAROBJECTVALID_INVALIDFORMAT;
+                       }
+                               
+               }
+               
+               if (ObjectName[SeekCount] == "END" &&
+                       ObjectData[SeekCount] == "VJOURNAL" &&
+                       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:VJOURNAL.
+       
+       for (vector<string>::iterator iter = ObjectName.begin();
+               iter != ObjectName.end(); iter++){
+       
+               if (ObjectName[SeekCount] == "END" &&
+                       ObjectData[SeekCount] == "VJOURNAL"){
+                       
+                       if (ValidEnd == false){
+                               ValidEnd = true;
+                       } else {
+                               return CALENDAROBJECTVALID_INVALIDFORMAT;
+                       }
+                               
+               }
+                       
+               SeekCount++;
+                       
+       }
+       
+       // Check if the VJOURNAL is valid.
+       
+       if (ValidBegin == true && 
+               ValidEnd == true && 
+               ValidDateTimeStamp == true &&
+               ValidUniqueID == true){
+                       
+               return CALENDAROBJECTVALID_OK;
+                       
+       } else {
+               
+               return CALENDAROBJECTVALID_INVALIDFORMAT;
+               
+       }
+       
+}
+
+void CalendarJournalObject::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/calendarjournal/CalendarJournal.h b/source/objects/calendarjournal/CalendarJournal.h
new file mode 100644 (file)
index 0000000..d192dfa
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __OBJECTS_CALENDARJOURNAL_CALENDARJOURNAL_H__
+#define __OBJECTS_CALENDARJOURNAL_CALENDARJOURNAL_H__
+
+#include "../calendarobject/CalendarObject.h"
+
+class CalendarJournalObject: 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