X-Git-Url: http://Server1/repobrowser/?a=blobdiff_plain;f=source%2Fvcard%2Fvcard34conv-v4conv.cpp;h=3e0ff06553e3d150778eb534e52a44655af87f3a;hb=495bcb79429e110e722da3102707e9a9b8cb2b72;hp=6d64eb353a775babf92d1cc887c80503ad22f828;hpb=fb95962b20989702f8d689875a977d150c087660;p=xestiaab%2F.git diff --git a/source/vcard/vcard34conv-v4conv.cpp b/source/vcard/vcard34conv-v4conv.cpp index 6d64eb3..3e0ff06 100644 --- a/source/vcard/vcard34conv-v4conv.cpp +++ b/source/vcard/vcard34conv-v4conv.cpp @@ -1,3 +1,21 @@ +// vcard34conv-v4conv.cpp - vCard34Conv Object vCard4 conversion subroutines. +// +// (c) 2012-2015 Xestia Software Development. +// +// This file is part of Xestia Address Book. +// +// Xestia Address Book is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by the +// Free Software Foundation, version 3 of the license. +// +// Xestia Address Book is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with Xestia Address Book. If not, see + #include "vcard34conv.h" #include "vcard.h" #include "../version.h" @@ -10,6 +28,8 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ + // Convert a vCard 3.0 format into the vCard 4.0 format. + std::map ContactFileLines; std::map ContactFileProcessed; std::map ContactFileProcessedWorking; @@ -101,12 +121,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. @@ -205,13 +225,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; @@ -280,16 +297,11 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ for (std::map::iterator itersub = ContactFileLines.begin(); itersub != ContactFileLines.end(); ++itersub){ - //DataLineProcess = DataLineProcessOriginal; - //DataLineSeek = DataLineSeekOrig; - ContactLineSub = itersub->second; ExtraLineSeekSub = TRUE; iterboolsub = ContactFileProcessed.find(itersub->first); - //std::map::iterator iterorig = ContactFileProcessed.find(itersub->first); - //std::map::iterator itersuborig; // Ignore certain variables as they are not needed. @@ -330,14 +342,10 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ continue; } - - //std::map::iterator itersub = iter; DataLineProcess.insert(std::make_pair(DataLineSeek, itersub->first)); DataLineSeek++; - - while (ExtraLineSeekSub == TRUE){ if (itersub == ContactFileLines.end()){ @@ -355,10 +363,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++; @@ -370,55 +375,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; @@ -519,8 +475,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ TempPropertyData.clear(); } else { - - wxT("PHOTODANCEMATCH!"); for (std::map::iterator xfiter = TempPropertyData.begin(); xfiter != TempPropertyData.end(); ++xfiter){ @@ -680,8 +634,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); - //FinalPropertyData.clear(); - //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); @@ -788,8 +740,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; @@ -897,8 +847,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); - //FinalPropertyData.clear(); - //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); @@ -941,7 +889,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ size_t ItemStringSeekLen = 0; int ItemSeekSub = 0; int ItemSeekSecSub = 0; - //int intValueSeek = 1; std::map NumberedName; std::map NumberedData; @@ -985,7 +932,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ SeekItemData = FALSE; std::map ItemMapIndex; - //std::map ItemNameIndex; // Look for item in the initial line, process into a proper line then // look for other lines with the same item association. @@ -1019,7 +965,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ // Get Item data. - //ContactLineSeekSub = ContactLineSeek; std::map::iterator itersub = iter; while (ExtraLineSeek == TRUE){ @@ -1053,8 +998,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; @@ -1155,8 +1098,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)); @@ -1237,8 +1179,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); - //FinalPropertyData.clear(); - //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); @@ -1264,8 +1204,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ wxSPropertyData.Clear(); wxSPropertyXVCard4Value.Clear(); wxSPropertyNameConv.Clear(); - //FinalPropertyData.clear(); - //FinalPropValue.clear(); PropertyData.clear(); PropertyLock.clear(); ContactLine.clear(); @@ -1328,8 +1266,6 @@ bool vCard34Conv::ConvertToV4(wxString *wxSData, vCard *vCardOut){ VCard3Value = FALSE; TempData.clear(); - //PropertyData.clear(); - //PropertyLock.clear(); }