Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Added source code, headers and unit testing to the XML vCard Property for ContactData...
[xestiaab/.git] / source / contacteditor / ContactDataObject.cpp
index 4dad1f9..b9035ed 100644 (file)
@@ -108,6 +108,7 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
        int KeyCount = 0;
        int VendorCount = 0;
        int XTokenCount = 0;
+       int XMLCount = 0;
        wxString ContactLine;
        wxString PropertyLine;
        wxString PropertySeg1;
@@ -220,6 +221,11 @@ ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){
                        ProcessSource(PropertySeg1, PropertySeg2, &SourceCount);
                        SourceCount++;
                
+               } else if (Property == wxT("XML")){
+               
+                       ProcessXML(PropertySeg1, PropertySeg2, &XMLCount);
+                       XMLCount++;
+               
                } else if (Property == wxT("MEMBER")){
 
                        ProcessMember(PropertySeg1, PropertySeg2, &GroupCount);
@@ -593,6 +599,54 @@ void ContactDataObject::ProcessSource(wxString PropertySeg1, wxString PropertySe
 
 }
 
+void ContactDataObject::ProcessXML(wxString PropertySeg1, wxString PropertySeg2, int *XMLCount){
+
+       std::map<int, int> SplitPoints;
+       std::map<int, int> SplitLength;
+
+       int intPrevValue = 5;
+       int intPref = 0;                        
+       int intType = 0;
+       
+       SplitValues(&PropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
+
+       intPrevValue = 4;
+       
+       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("ALTID")){
+
+                       XMLListAltID.erase(*XMLCount);
+                       XMLListAltID.insert(std::make_pair(*XMLCount, PropertyValue));
+               
+               }
+               
+       }
+
+       XMLList.insert(std::make_pair(*XMLCount, PropertySeg2));
+
+}
+
 void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySeg2, int *GroupCount){
 
        std::map<int, int> SplitPoints;
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