X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fobjects%2Fcalendarobject%2FCalendarObject.cpp;h=aecb136388dab31f88effecdef2404ce2385b305;hb=d6e10239b4fe13c9fdbf35db6f9325d8677cb65c;hp=1178ad064cc1dbe6ad01403472516b913bdd5a5c;hpb=165637cbdcf8c90dba03710b388d8fe1d196cbe4;p=xestiacalendar%2F.git diff --git a/source/objects/calendarobject/CalendarObject.cpp b/source/objects/calendarobject/CalendarObject.cpp index 1178ad0..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,6 +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