CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
intPrevValue = 7;
+ bool PropertyMatched = FALSE;
for (std::map<int, int>::iterator intiter = SplitPoints.begin();
intiter != SplitPoints.end(); ++intiter){
CaptureString(&PropertyValue, FALSE);
- if (PropertyName == wxT("ALTID")){
-
- CalendarListAltID.erase(*CalURICount);
- CalendarListAltID.insert(std::make_pair(*CalURICount, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
-
- CalendarListPID.erase(*CalURICount);
- CalendarListPID.insert(std::make_pair(*CalURICount, PropertyValue));
+ ProcessStringValue(&PropertyName, "ALTID", &CalendarListAltID, &PropertyValue, CalURICount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "PID", &CalendarListPID, &PropertyValue, CalURICount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarListMediatype, &PropertyValue, CalURICount, &PropertyMatched);
+ ProcessIntegerValue(&PropertyName, "PREF", &CalendarListPref, &PropertyValue, CalURICount, &PropertyMatched);
- } else if (PropertyName == wxT("PREF")){
-
- ProcessIntegerValue(&CalendarListPref, &PropertyValue, CalURICount);
+ if (PropertyMatched == TRUE){
- } else if (PropertyName == wxT("MEDIATYPE")){
+ PropertyMatched = FALSE;
+ continue;
- CalendarListMediatype.erase(*CalURICount);
- CalendarListMediatype.insert(std::make_pair(*CalURICount, PropertyValue));
+ }
- } else {
+ if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
- // Something else we don't know about so append
- // to the tokens variable.
+ if (FirstToken == TRUE){
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
+ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+ FirstToken = FALSE;
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
+ } else {
+
+ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
}
CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
intPrevValue = 7;
+ bool PropertyMatched = FALSE;
for (std::map<int, int>::iterator intiter = SplitPoints.begin();
intiter != SplitPoints.end(); ++intiter){
CaptureString(&PropertyValue, FALSE);
- if (PropertyName == wxT("ALTID")){
-
- CalendarRequestListAltID.erase(*CalAdrURICount);
- CalendarRequestListAltID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
-
- CalendarRequestListPID.erase(*CalAdrURICount);
- CalendarRequestListPID.insert(std::make_pair(*CalAdrURICount, PropertyValue));
+ ProcessStringValue(&PropertyName, "ALTID", &CalendarRequestListAltID, &PropertyValue, CalAdrURICount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "PID", &CalendarRequestListPID, &PropertyValue, CalAdrURICount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "MEDIATYPE", &CalendarRequestListMediatype, &PropertyValue, CalAdrURICount, &PropertyMatched);
+ ProcessIntegerValue(&PropertyName, "PREF", &CalendarRequestListPref, &PropertyValue, CalAdrURICount, &PropertyMatched);
- } else if (PropertyName == wxT("PREF")){
-
- ProcessIntegerValue(&CalendarRequestListPref, &PropertyValue, CalAdrURICount);
+ if (PropertyMatched == TRUE){
- } else if (PropertyName == wxT("MEDIATYPE")){
+ PropertyMatched = FALSE;
+ continue;
- CalendarRequestListMediatype.erase(*CalAdrURICount);
- CalendarRequestListMediatype.insert(std::make_pair(*CalAdrURICount, PropertyValue));
+ }
- } else {
+ if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
- // Something else we don't know about so append
- // to the tokens variable.
+ if (FirstToken == TRUE){
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
+ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+ FirstToken = FALSE;
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
+ } else {
+
+ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
}
CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
intPrevValue = 6;
+ bool PropertyMatched = FALSE;
for (std::map<int, int>::iterator intiter = SplitPoints.begin();
intiter != SplitPoints.end(); ++intiter){
CaptureString(&PropertyValue, FALSE);
- if (PropertyName == wxT("ALTID")){
-
- FreeBusyListAltID.erase(*FreeBusyAddressCount);
- FreeBusyListAltID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
-
- } else if (PropertyName == wxT("PID")){
-
- FreeBusyListPID.erase(*FreeBusyAddressCount);
- FreeBusyListPID.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
+ ProcessStringValue(&PropertyName, "ALTID", &FreeBusyListAltID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "PID", &FreeBusyListPID, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "MEDIATYPE", &FreeBusyListMediatype, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
+ ProcessIntegerValue(&PropertyName, "PREF", &FreeBusyListPref, &PropertyValue, FreeBusyAddressCount, &PropertyMatched);
- } else if (PropertyName == wxT("PREF")){
-
- ProcessIntegerValue(&FreeBusyListPref, &PropertyValue, FreeBusyAddressCount);
+ if (PropertyMatched == TRUE){
- } else if (PropertyName == wxT("MEDIATYPE")){
+ PropertyMatched = FALSE;
+ continue;
- FreeBusyListMediatype.erase(*FreeBusyAddressCount);
- FreeBusyListMediatype.insert(std::make_pair(*FreeBusyAddressCount, PropertyValue));
+ }
- } else {
+ if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
- // Something else we don't know about so append
- // to the tokens variable.
+ if (FirstToken == TRUE){
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
+ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+ FirstToken = FALSE;
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
+ } else {
+
+ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
}
CheckType(&PropertySeg1, &SplitPoints, &SplitLength, &intPrevValue, &PropType);
intPrevValue = 4;
+ bool PropertyMatched = FALSE;
for (std::map<int, int>::iterator intiter = SplitPoints.begin();
intiter != SplitPoints.end(); ++intiter){
PropertyValue.Remove(0, 1);
- }
+ }
- if (PropertyName == wxT("ALTID")){
-
- KeyListAltID.erase(*KeyCount);
- KeyListAltID.insert(std::make_pair(*KeyCount, PropertyValue));
+ ProcessStringValue(&PropertyName, "ALTID", &KeyListAltID, &PropertyValue, KeyCount, &PropertyMatched);
+ ProcessStringValue(&PropertyName, "PID", &KeyListPID, &PropertyValue, KeyCount, &PropertyMatched);
+ ProcessIntegerValue(&PropertyName, "PREF", &KeyListPref, &PropertyValue, KeyCount, &PropertyMatched);
- } else if (PropertyName == wxT("PID")){
-
- KeyListPID.erase(*KeyCount);
- KeyListPID.insert(std::make_pair(*KeyCount, PropertyValue));
+ if (PropertyMatched == TRUE){
- } else if (PropertyName == wxT("PREF")){
-
- ProcessIntegerValue(&KeyListPref, &PropertyValue, KeyCount);
+ PropertyMatched = FALSE;
+ continue;
- } else {
+ }
+
+ if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
- // Something else we don't know about so append
- // to the tokens variable.
+ if (FirstToken == TRUE){
- if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty() && PropertyName != wxT("TYPE")){
+ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+ FirstToken = FALSE;
- if (FirstToken == TRUE){
-
- PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
- FirstToken = FALSE;
-
- } else {
-
- PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
-
- }
+ } else {
+
+ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
}
}
+void ProcessTokens(wxString *PropertyName,
+ wxString *PropertyValue,
+ wxString *PropertyTokens,
+ bool FirstToken){
+
+ if (!PropertyName->IsEmpty() && !PropertyValue->IsEmpty() && *PropertyName != wxT("TYPE")){
+
+ if (FirstToken == TRUE){
+
+ PropertyTokens->Append(*PropertyName + wxT("=") + *PropertyValue);
+ FirstToken = FALSE;
+
+ } else {
+
+ PropertyTokens->Append(wxT(";") + *PropertyName + wxT("=") + *PropertyValue);
+
+ }
+
+ }
+
+}
+
void ProcessStringValue(wxString *PropertyName,
wxString PropertyNameMatch,
std::map<int,wxString> *MapPtr,
}
-void ProcessIntegerValue(std::map<int,int> *PrefPtr,
- wxString *PropertyValue,
- int *ItemCount){
-
- int PriorityNumber = 0;
- bool ValidNumber = TRUE;
-
- try{
- PriorityNumber = std::stoi(PropertyValue->ToStdString());
- }
-
- catch(std::invalid_argument &e){
- ValidNumber = FALSE;
- }
-
- if (ValidNumber == TRUE){
-
- PrefPtr->erase(*ItemCount);
- PrefPtr->insert(std::make_pair(*ItemCount, PriorityNumber));
-
- }
-
-}
-
void SplitValues(wxString *PropertyLine,
std::map<int,int> *SplitPoints,
std::map<int,int> *SplitLength,