Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Move INSTALL, LICENSE, README, THANKS and TODO into root directory
[xestiaab/.git] / source / vcard / vcard34conv-v4conv.cpp
index 7c32094..f9a70ca 100644 (file)
@@ -28,6 +28,8 @@
 
 bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
        
+       // Convert a vCard 3.0 format into the vCard 4.0 format.
+       
        std::map<int, wxString> ContactFileLines;
        std::map<int, bool> ContactFileProcessed;
        std::map<int, bool> ContactFileProcessedWorking;
@@ -55,21 +57,13 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
        bool PropertyFind = TRUE;
        bool ExtraLineSeek = TRUE;
        bool ExtraLineSeekSub = TRUE;
-       bool BirthdayProcessed = FALSE;
-       bool AnniversaryProcessed = FALSE;
-       bool FNProcessed = FALSE;
-       bool GenderProcessed = FALSE;
-       bool NameProcessed = FALSE;
        bool FNFirst = FALSE;
        bool NicknameFirst = FALSE;
        bool TitleFirst = FALSE;
        bool OrganisationFirst = FALSE;
        bool NoteFirst = FALSE;
        bool PhotoFirst = FALSE;
-       bool LogoFirst = FALSE;
-       bool NameFirst = FALSE;
        bool FoundData = FALSE;
-       int intExtraNickname = 0;
        wxString wxSProperty;
        wxString wxSPropertyVCARD4;
        wxString wxSPropertySeg1;
@@ -105,7 +99,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
        
        bool XVCard4Value = FALSE;
        bool VCard3Value = FALSE;
-       bool SeekItemData = FALSE;
        
        wxString strVer;
     
@@ -119,12 +112,12 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
        vCardOut->AddRaw(wxT("VERSION"), wxT("4.0"));
        vCardOut->AddRaw(wxT("PRODID"), strVer);
        
-               // FN
-               // NICKNAME
-               // TITLE
-               // ORG
-               // NOTE
-               // PHOTO
+       // FN
+       // NICKNAME
+       // TITLE
+       // ORG
+       // NOTE
+       // PHOTO
                
        // Process the properties which have X-FIRST.
        
@@ -223,13 +216,10 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                        if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
                
                                wxSPropertyNextLine.Remove(0, 1);
-                               //wxSPropertyNextLine.Trim(FALSE);
-                               //ContactLine.Trim();
                                ContactLine.Append(wxSPropertyNextLine);
                                DataLineProcessOriginal.insert(std::make_pair(DataLineSeekOrig, iterboolsub->first));
                                DataLineSeekOrig++;
-                               //iterboolsub->second = TRUE;
-               
+                               
                        } else {
                        
                                ExtraLineSeek = FALSE;
@@ -298,16 +288,11 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                        for (std::map<int,wxString>::iterator itersub = ContactFileLines.begin(); 
                        itersub != ContactFileLines.end(); ++itersub){
                
-                               //DataLineProcess = DataLineProcessOriginal;
-                               //DataLineSeek = DataLineSeekOrig;
-               
                                ContactLineSub = itersub->second;
                
                                ExtraLineSeekSub = TRUE;
 
                                iterboolsub = ContactFileProcessed.find(itersub->first);
-                               //std::map<int,bool>::iterator iterorig = ContactFileProcessed.find(itersub->first);
-                               //std::map<int,bool>::iterator itersuborig;
                
                                // Ignore certain variables as they are not needed.
                
@@ -348,14 +333,10 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                                        continue;
                
                                }
-               
-                               //std::map<int,wxString>::iterator itersub = iter;
                                
                                DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first));
                                DataLineSeek++;
 
-
-
                                while (ExtraLineSeekSub == TRUE){
 
                                        if (itersub == ContactFileLines.end()){
@@ -373,10 +354,7 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                                        if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
 
                                                wxSPropertyNextLine.Remove(0, 1);
-                                               //wxSPropertyNextLine.Trim(FALSE);
-                                               //ContactLine.Trim();
                                                ContactLineSub.Append(wxSPropertyNextLine);
-                                               //iterboolsub->second = TRUE;
                                                DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first));
                                                DataLineSeek++;
 
@@ -388,55 +366,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                                        }
 
                                }
-
-                               /*while (ExtraLineSeekSub == TRUE && iterboolsub != ContactFileProcessedWorking.end()){
-               
-                                       // Check if there is extra data on the next line 
-                                       // (indicated by space or tab at the start) and add data.
-               
-                                       itersub++;
-
-                                       iterboolsub = ContactFileProcessedWorking.find(itersub->first);
-                       
-                                       if (iterboolsub->second == TRUE){
-                       
-                                               continue;
-                       
-                                       }
-                       
-                                       if (itersub == ContactFileLines.end()){
-                       
-                                               break;
-                       
-                                       }                       
-               
-                                       wxSPropertyNextLine = itersub->second;
-               
-                                       if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
-               
-                                               wxSPropertyNextLine.Remove(0, 1);
-                                               //wxSPropertyNextLine.Trim(FALSE);
-                                               //ContactLine.Trim();
-                                               ContactLineSub.Append(wxSPropertyNextLine);
-                                               //iterboolsub->second = TRUE;
-                                               DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first));
-                                               DataLineSeek++;
-               
-                                       } else {
-                       
-                                               itersub--;
-                                               ExtraLineSeekSub = FALSE;
-                       
-                                       }
-
-                                       if (iterboolsub == ContactFileProcessedWorking.end()){
-
-                                               break;
-                                               ExtraLineSeekSub = FALSE;
-
-                                       }
-               
-                               }*/
                
                                ContactLineSubLen = ContactLineSub.Len();
                                PropertyFind = TRUE;
@@ -537,8 +466,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                                        TempPropertyData.clear();
                        
                                } else {
-                               
-                                       wxT("PHOTODANCEMATCH!");
                        
                                        for (std::map<wxString, wxString>::iterator xfiter = TempPropertyData.begin(); 
                                        xfiter != TempPropertyData.end(); ++xfiter){
@@ -698,8 +625,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                wxSPropertyData.Clear();
                wxSPropertyXVCard4Value.Clear();
                wxSPropertyNameConv.Clear();
-               //FinalPropertyData.clear();
-               //FinalPropValue.clear();
                PropertyData.clear();
                PropertyLock.clear();
                ContactLine.clear();
@@ -806,8 +731,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                        if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
                
                                wxSPropertyNextLine.Remove(0, 1);
-                               //wxSPropertyNextLine.Trim(FALSE);
-                               //ContactLine.Trim();
                                ContactLine.Append(wxSPropertyNextLine);
                                iterboolsub->second = TRUE;
                
@@ -915,8 +838,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                wxSPropertyData.Clear();
                wxSPropertyXVCard4Value.Clear();
                wxSPropertyNameConv.Clear();
-               //FinalPropertyData.clear();
-               //FinalPropValue.clear();
                PropertyData.clear();
                PropertyLock.clear();
                ContactLine.clear();
@@ -925,41 +846,7 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
        
        }
        
-       int FNCount = 0;
-       int NameCount = 0;
-       int NicknameCount = 0;
-       int ADRCount = 0;
-       int EmailCount = 0;
-       int IMPPCount = 0;
-       int TelCount = 0;
-       int LangCount = 0;
-       int TZCount = 0;
-       int GeoCount = 0;
-       int URLCount = 0;
-       int RelatedCount = 0;
-       int TitleCount = 0;
-       int RoleCount = 0;
-       int OrgCount = 0;
-       int NoteCount = 0;
-       int CategoryCount = 0;
-       int PhotoCount = 0;
-       int LogoCount = 0;
-       int SoundCount = 0;
-       int CalAdrCount = 0;
-       int CalReqAdrCount = 0;
-       int FreeBusyCount = 0;
-       int KeyCount = 0;
-       int VendorCount = 0;
-       int XTokenCount = 0;
-       int ItemSeek = 1;
-       int MaxItemNumber = 0;
-       int ItemOrdered = 0;
-       int ItemUnordered = 0;
-       int ItemNumber = 0;
        size_t ItemStringSeekLen = 0;
-       int ItemSeekSub = 0;
-       int ItemSeekSecSub = 0;
-       //int intValueSeek = 1;
        
        std::map<int, wxString> NumberedName;
        std::map<int, wxString> NumberedData;
@@ -1000,10 +887,8 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
        
        XVCard4Value = FALSE;
        VCard3Value = FALSE;
-       SeekItemData = FALSE;
        
        std::map<wxString, void*> ItemMapIndex;
-       //std::map<wxString, wxString> ItemNameIndex;
        
        // Look for item in the initial line, process into a proper line then
        // look for other lines with the same item association.
@@ -1037,7 +922,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                
                // Get Item data.
 
-               //ContactLineSeekSub = ContactLineSeek;
                std::map<int,wxString>::iterator itersub = iter;
 
                while (ExtraLineSeek == TRUE){
@@ -1071,8 +955,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                        if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
                
                                wxSPropertyNextLine.Remove(0, 1);
-                               //wxSPropertyNextLine.Trim(FALSE);
-                               //ContactLine.Trim();
                                ContactLine.Append(wxSPropertyNextLine);
                                iterboolsub->second = TRUE;
                
@@ -1173,8 +1055,7 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                        iterboolsub->second = TRUE;
                
                }
-               
-               //ItemNameIndex.insert(std::make_pair(ItemStringSeek, ItemPropName));
+
                ItemListData->insert(std::make_pair(ItemIndex, ContactLineSub));
                ItemMapIndex.insert(std::make_pair(ItemStringSeek, ItemListData));
                
@@ -1255,8 +1136,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                                wxSPropertyData.Clear();
                                wxSPropertyXVCard4Value.Clear();
                                wxSPropertyNameConv.Clear();
-                               //FinalPropertyData.clear();
-                               //FinalPropValue.clear();
                                PropertyData.clear();
                                PropertyLock.clear();
                                ContactLine.clear();
@@ -1282,8 +1161,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                        wxSPropertyData.Clear();
                        wxSPropertyXVCard4Value.Clear();
                        wxSPropertyNameConv.Clear();
-                       //FinalPropertyData.clear();
-                       //FinalPropValue.clear();
                        PropertyData.clear();
                        PropertyLock.clear();
                        ContactLine.clear();
@@ -1346,8 +1223,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){
                VCard3Value = FALSE;
        
                TempData.clear();
-               //PropertyData.clear();
-               //PropertyLock.clear();
                
        }
        
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