Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Finished remaining code and unit tests for the N vCard property for ContactDataObject.
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index 5f9ca27..55d2a14 100644 (file)
@@ -505,6 +505,82 @@ void ContactDataObject::ProcessN(wxString PropertySeg1, wxString PropertySeg2){
        
        // Split the name data.
        
+       int intSplitSeek = 0;           
+       int intSplitsFound = 0;
+       int intSplitSize = 0;
+       int intPropertyLen = PropertySeg2.Len();
+       
+       std::map<int,wxString> NameValues;
+       intPrevValue = 0;                                       
+       
+       for (int i = 0; i <= intPropertyLen; i++){
+       
+               if (PropertySeg2.Mid(i, 1) == wxT(";") && PropertySeg2.Mid((i - 1), 1) != wxT("\\")){
+                       
+                       NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, intSplitSize)));
+                       
+                       intSplitSeek = i;
+                       intSplitSeek++;
+                       
+                       if (intSplitsFound == 4){
+                       
+                               NameValues.insert(std::make_pair(++intSplitsFound, PropertySeg2.Mid(intSplitSeek, wxString::npos)));
+                               break;
+                       
+                       }
+                       
+                       intSplitSize = 0;
+                       continue;
+       
+               }
+               
+               intSplitSize++;
+
+       }
+       
+       // Split the data into several parts.
+                       
+       for (std::map<int, wxString>::iterator iter = NameValues.begin(); 
+       iter != NameValues.end(); ++iter){
+       
+               if (iter->first == 1){
+               
+                       // Deal with family name.
+                       
+                       NameSurname = iter->second;
+               
+               } else if (iter->first == 2){
+               
+                       // Deal with given names.
+                       
+                       NameForename = iter->second;
+               
+               } else if (iter->first == 3){
+               
+                       // Deal with additional names.
+                       
+                       NameOtherNames = iter->second;
+               
+               } else if (iter->first == 4){
+               
+                       // Deal with honorifix prefixes and suffixes.
+
+                       NameTitle = iter->second;
+               
+                       iter++;
+                       
+                       if (iter == NameValues.end()){
+                       
+                               break;
+                       
+                       }
+               
+                       NameSuffix = iter->second;
+               
+               }
+       
+       }
+       
        // Add the name token data.
        
        if (!PropertyTokens.IsEmpty()){
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