PropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
if (Property == wxT("KIND") && KindProcessed == FALSE){
-
- // See frmContactEditor-LoadGroup.cpp
-
+
ProcessKind(PropertySeg2);
} else if (Property == wxT("MEMBER")){
- // See frmContactEditor-LoadGroup.cpp
-
ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
GroupCount++;
intPrevValue = 7;
- // Look for type before continuing.
-
wxString PropertyName;
wxString PropertyValue;
wxString PropertyData;
intPrevValue = intiter->second;
CaptureString(&PropertyValue, FALSE);
-
- //ContactProcess::ContactProcessCaptureStrings(&PropertyValue);
if (PropertyName == wxT("ALTID")){
void ContactDataObject::ProcessFN(wxString PropertySeg1, wxString PropertySeg2, int *FNCount){
+ std::map<int, int> SplitPoints;
+ std::map<int, int> SplitLength;
+
+ int intPrevValue = 4;
+ int intPref = 0;
+ int intType = 0;
+
+ SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
+
+ intPrevValue = 3;
+
+ wxString PropertyName;
+ wxString PropertyValue;
+ wxString PropertyData;
+ wxString PropertyTokens;
+ std::map<int,int>::iterator SLiter;
+ bool FirstToken = TRUE;
+
+ for (std::map<int, int>::iterator intiter = SplitPoints.begin();
+ intiter != SplitPoints.end(); ++intiter){
+
+ SLiter = SplitLength.find(intiter->first);
+
+ PropertyData = PropertySeg1.Mid(intPrevValue, (SLiter->second));
+
+ wxStringTokenizer PropertyElement (PropertyData, wxT("="));
+ PropertyName = PropertyElement.GetNextToken();
+ PropertyValue = PropertyElement.GetNextToken();
+
+ intPrevValue = intiter->second;
+
+ CaptureString(&PropertyValue, FALSE);
+
+ if (PropertyName == wxT("TYPE")){
+
+ if (!PropertyValue.IsEmpty() || PropertyValue == wxT("home") ||
+ PropertyValue == wxT("work") ){
+
+ FullNamesListType.erase(*FNCount);
+ FullNamesListType.insert(std::make_pair(*FNCount, PropertyValue));
+
+ }
+
+ } else if (PropertyName == wxT("LANGUAGE")){
+
+ FullNamesListLanguage.erase(*FNCount);
+ FullNamesListLanguage.insert(std::make_pair(*FNCount, PropertyValue));
+
+ } else if (PropertyName == wxT("ALTID")){
+
+ FullNamesListAltID.erase(*FNCount);
+ FullNamesListAltID.insert(std::make_pair(*FNCount, PropertyValue));
+
+ } else if (PropertyName == wxT("PID")){
+
+ FullNamesListPID.erase(*FNCount);
+ FullNamesListPID.insert(std::make_pair(*FNCount, PropertyValue));
+
+ } else if (PropertyName == wxT("PREF")){
+
+ int PriorityNumber = 0;
+ bool ValidNumber = TRUE;
+
+ try{
+ PriorityNumber = std::stoi(PropertyValue.ToStdString());
+ }
+
+ catch(std::invalid_argument &e){
+ ValidNumber = FALSE;
+ }
+
+ if (ValidNumber == TRUE){
+
+ FullNamesListPref.erase(*FNCount);
+ FullNamesListPref.insert(std::make_pair(*FNCount, PriorityNumber));
+
+ }
+
+ } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
+
+ if (FirstToken == TRUE){
+
+ PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
+ FirstToken = FALSE;
+
+ } else {
+
+ PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
+
+ }
+
+ }
+
+ }
+
FullNamesList.insert(std::make_pair(*FNCount, PropertySeg2));
+ if (!PropertyTokens.IsEmpty()){
+
+ FullNamesListTokens.insert(std::make_pair(*FNCount, PropertyTokens));
+
+ }
+
}
void SplitValues(wxString *PropertyLine,
ASSERT_NE(TestFile.GroupsListPref.end(), TestFileIntIter);
ASSERT_EQ(45, TestFileIntIter->second);
- // Check that MEDIATYPE parameter.
+ // Check the MEDIATYPE parameter.
TestFileIter = TestFile.GroupsListMediaType.find(0);
ASSERT_NE(TestFile.GroupsListMediaType.end(), TestFileIter);
TestFileIter = TestFile.FullNamesList.find(0);
ASSERT_NE(TestFile.FullNamesList.end(), TestFileIter);
ASSERT_EQ("Test Contact", TestFileIter->second);
+
+ // Check the TYPE parameter.
+
+ TestFileIter = TestFile.FullNamesListType.find(0);
+ ASSERT_NE(TestFile.FullNamesListType.end(), TestFileIter);
+ ASSERT_EQ("work", TestFileIter->second);
+
+ // Check the LANGUAGE parameter.
+
+ TestFileIter = TestFile.FullNamesListLanguage.find(0);
+ ASSERT_NE(TestFile.FullNamesListLanguage.end(), TestFileIter);
+ ASSERT_EQ("kw", TestFileIter->second);
+
+ // Check the ALTID parameter.
+
+ TestFileIter = TestFile.FullNamesListAltID.find(0);
+ ASSERT_NE(TestFile.FullNamesListAltID.end(), TestFileIter);
+ ASSERT_EQ("500", TestFileIter->second);
+
+ // Check the PID parameter.
+ TestFileIter = TestFile.FullNamesListPID.find(0);
+ ASSERT_NE(TestFile.FullNamesListPID.end(), TestFileIter);
+ ASSERT_EQ("40", TestFileIter->second);
+
+ // Check the PREF parameter.
+
+ TestFileIntIter = TestFile.FullNamesListPref.find(0);
+ ASSERT_NE(TestFile.FullNamesListPref.end(), TestFileIntIter);
+ ASSERT_EQ(45, TestFileIntIter->second);
+
+ // Check for the extra tokens parameter.
+
+ TestFileIter = TestFile.FullNamesListTokens.find(0);
+ ASSERT_NE(TestFile.FullNamesListTokens.end(), TestFileIter);
+ ASSERT_EQ("EXAMPLE=Baaa", TestFileIter->second);
+
}
// TODO: Add tests for the Contact Loading process.
\ No newline at end of file