X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fobjects%2Fcalendarobject%2FCalendarObject.cpp;h=aecb136388dab31f88effecdef2404ce2385b305;hb=d6e10239b4fe13c9fdbf35db6f9325d8677cb65c;hp=e63d9d8b532efd60a6b518d0537778912c262e41;hpb=22e1d3554bc2a3d46126ed60c4a4454e1b0f7f65;p=xestiacalendar%2F.git diff --git a/source/objects/calendarobject/CalendarObject.cpp b/source/objects/calendarobject/CalendarObject.cpp index e63d9d8..aecb136 100644 --- a/source/objects/calendarobject/CalendarObject.cpp +++ b/source/objects/calendarobject/CalendarObject.cpp @@ -144,6 +144,20 @@ CalendarObjectLoadResult CalendarObject::LoadString(std::string *LoadStringData) CalendarObjectValidResult BaseDataResult = ValidBaseObject(); CalendarObjectValidResult EventDataResult = ValidObject(); + if (BaseDataResult != CALENDAROBJECTVALID_OK || + EventDataResult != CALENDAROBJECTVALID_OK){ + + StringProcResult = CALENDAROBJECTLOAD_INVALIDFORMAT; + + } else { + + StringProcResult = CALENDAROBJECTLOAD_OK; + + } + + ProcessBaseData(); + ProcessData(); + return StringProcResult; } @@ -171,7 +185,15 @@ CalendarObjectValidResult CalendarObject::ValidBaseObject(){ } } - + + if (ObjectName[SeekCount] == "END" && + ObjectData[SeekCount] == "VCALENDAR" && + ValidBegin == false){ + + return CALENDAROBJECTVALID_INVALIDFORMAT; + + } + SeekCount++; } @@ -234,4 +256,48 @@ CalendarObjectValidResult CalendarObject::ValidBaseObject(){ } +} + +void CalendarObject::ProcessBaseData(){ + + // Process the base object data. + + multimap DataReceived; + + // Get the method (METHOD). + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "METHOD"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + MethodTokens = DataReceived.begin()->first.substr(7); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + MethodData = DataReceived.begin()->second; + + } + + // Get the calendar scale (CALSCALE). + + DataReceived = ProcessTextVectors(&ObjectName, &ObjectData, false, "CALSCALE"); + + if (DataReceived.begin() != DataReceived.end()){ + + try { + CalendarScaleTokens = DataReceived.begin()->first.substr(9); + } + + catch(const out_of_range &oor){ + // Do nothing as there is no data. + } + + CalendarScaleData = DataReceived.begin()->second; + + } + } \ No newline at end of file