// vcard34conv.cpp - vCard34Conv Object // // (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" #include "../common/textprocessing.h" #include #include #include #include #include #include #include // vcard.cpp - Deals with vCard 4.0 formatted files meeting the // RFC 6350 specification. vCard34Conv::vCard34Conv(){ // Setup the vCard34Conv object. vCardBegin = FALSE; vCardEnd = FALSE; vCardFN = FALSE; vCardVersion = 0.0; SettingCount = 0; } void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString *wxSPropertySeg1Ptr, wxString *wxSPropertySeg2Ptr, wxString *wxSPropertyPropValuesOut, wxString *wxSPropertyDataOut, wxString *wxSPropertyXVCard4Value, wxString *wxSPropertyDataNameOut, std::map *PropertyDataMap, std::map *PropertyLockMap, bool ProcessItemData, bool *VCardV3Value, bool *XVCardV4Value){ // Convert and format data to vCard 4.0 specifications. wxString wxSProperty; wxString wxSPropertySeg1Chopped; size_t intPropertyLen; if (ProcessItemData == TRUE){ wxStringTokenizer wxSPropertySplit(*wxSPropertyName, wxT(".")); wxSPropertySplit.GetNextToken(); wxSProperty = wxSPropertySplit.GetNextToken(); // Look for . in wxSPropertySeg1Ptr and remove all data before // the . int ItemSeek = wxSPropertySeg1Ptr->Find(wxT(".")); wxSPropertySeg1Chopped = wxSPropertySeg1Ptr->Mid((ItemSeek + 1)); } else { wxSProperty = *wxSPropertyName; } // Go through each of the vCard 3.0 properties. // EMAIL if (wxSProperty == wxT("EMAIL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("EMAIL"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("INTERNET")){ continue; } if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ PropertyName = wxT("PREF"); PropertyValue = wxT("50"); } else { continue; } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // ADR if (wxSProperty == wxT("ADR")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ if (ProcessItemData == FALSE){ PropertyName = wxT("PREF"); PropertyValue = wxT("50"); } else { continue; } } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // LABEL if (wxSProperty == wxT("LABEL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ADR"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } PropertyDataMap->insert(std::make_pair(wxT("X-LABEL"), wxT("TRUE"))); } // IMPP if (wxSProperty == wxT("IMPP")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 6; wxStringTokenizer IMPPSplit(*wxSPropertySeg2Ptr, wxT(":")); wxString IMPPType; wxString IMPPData; IMPPType = IMPPSplit.GetNextToken(); if (IMPPSplit.HasMoreTokens()){ IMPPData = IMPPSplit.GetNextToken(); if (IMPPType == wxT("ymsgr")){ IMPPType = wxT("yahoo"); } *wxSPropertySeg2Ptr = IMPPType + wxT(":") + IMPPData; } wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("IMPP"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("X-SERVICE-TYPE")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // TEL if (wxSProperty == wxT("TEL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map TelType; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(wxT("tel:")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("TEL"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ TelType.insert(std::make_pair(wxT("home"), wxT("home"))); continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ TelType.insert(std::make_pair(wxT("work"), wxT("work"))); continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process the telephone type options. // text if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXT") || PropertyValue == wxT("text"))){ TelType.insert(std::make_pair(wxT("text"), wxT("text"))); continue; } // voice if (PropertyName == wxT("type") && (PropertyValue == wxT("VOICE") || PropertyValue == wxT("voice"))){ TelType.insert(std::make_pair(wxT("voice"), wxT("voice"))); continue; } // fax if (PropertyName == wxT("type") && (PropertyValue == wxT("FAX") || PropertyValue == wxT("fax"))){ TelType.insert(std::make_pair(wxT("fax"), wxT("fax"))); continue; } // cell if (PropertyName == wxT("type") && (PropertyValue == wxT("CELL") || PropertyValue == wxT("cell"))){ TelType.insert(std::make_pair(wxT("cell"), wxT("cell"))); continue; } // video if (PropertyName == wxT("type") && (PropertyValue == wxT("VIDEO") || PropertyValue == wxT("video"))){ TelType.insert(std::make_pair(wxT("video"), wxT("video"))); continue; } // pager if (PropertyName == wxT("type") && (PropertyValue == wxT("PAGER") || PropertyValue == wxT("pager"))){ TelType.insert(std::make_pair(wxT("pager"), wxT("pager"))); continue; } // textphone if (PropertyName == wxT("type") && (PropertyValue == wxT("TEXTPHONE") || PropertyValue == wxT("textphone"))){ TelType.insert(std::make_pair(wxT("textphone"), wxT("textphone"))); continue; } if (PropertyName == wxT("type") && PropertyValue.Find(wxT(",")) != wxNOT_FOUND){ wxStringTokenizer TypeSplit(PropertyValue, wxT(",")); wxString TypeSplitData; while (TypeSplit.HasMoreTokens()){ TypeSplitData = TypeSplit.GetNextToken(); TelType.insert(std::make_pair(TypeSplitData, TypeSplitData)); TypeSplitData.clear(); } } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } wxString TelFinalString; bool TelFirstToken = TRUE; for (std::map::iterator intiter = TelType.begin(); intiter != TelType.end(); ++intiter){ // Process the type data into a single value. (e.g. TYPE="work,voice,cell"). if (TelFirstToken == TRUE){ TelFinalString.Append(wxT("\"")); TelFinalString.Append(intiter->first); TelFirstToken = FALSE; } else { TelFinalString.Append(wxT(",")); TelFinalString.Append(intiter->first); } } if (TelFirstToken == FALSE){ TelFinalString.Append(wxT("\"")); } if (!TelFinalString.IsEmpty()){ if (PropertyDataMap->find(wxT("TYPE")) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(wxT("type"), TelFinalString)); PropertyLockMap->insert(std::make_pair(wxT("type"), TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(wxT("type"), TelFinalString)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(wxT("type"), TRUE)); } } } // RELATED if (wxSProperty == wxT("X-ABRELATEDNAMES")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 18; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("RELATED"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // URL if (wxSProperty == wxT("URL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("URL"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ continue; } if (PropertyName == wxT("type") && (PropertyValue == wxT("HOME") || PropertyValue == wxT("home"))){ PropertyValue = wxT("home"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("WORK") || PropertyValue == wxT("work"))){ PropertyValue = wxT("work"); } if (PropertyName == wxT("type") && (PropertyValue == wxT("OTHER") || PropertyValue == wxT("other"))){ PropertyName = wxT("X-TYPE"); PropertyValue = wxT("other"); } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // TITLE if (wxSProperty == wxT("TITLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 7; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("TITLE"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // FN if (wxSProperty == wxT("FN")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 4; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("FN"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // N if (wxSProperty == wxT("N")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 3; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("N"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // UID if (wxSProperty == wxT("UID")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("UID"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // NICKNAME if (wxSProperty == wxT("NICKNAME")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 10; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("NICKNAME"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // GENDER if (wxSProperty == wxT("GENDER")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 8; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("GENDER"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // BDAY if (wxSProperty == wxT("BDAY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 6; *wxSPropertyDataNameOut = wxT("BDAY"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ PropertyXOmitYear = PropertyValue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } // Convert the date from YYYY-MM-DD to YYYYMMDD or --MMDD depending on if the // year matches the X-APPLE-OMIT-YEAR value. wxStringTokenizer DateSplit(*wxSPropertySeg2Ptr, wxT("-")); wxString DateProc; wxString FinalDate; DateProc = DateSplit.GetNextToken(); if (DateProc == PropertyXOmitYear){ FinalDate.Append(wxT("--")); } else { FinalDate.Append(DateProc); } DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); wxSPropertyDataOut->Append(FinalDate); } // ANNIVERSARY if (wxSProperty == wxT("ANNIVERSARY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 13; *wxSPropertyDataNameOut = wxT("ANNIVERSARY"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; if (PropertyName == wxT("X-APPLE-OMIT-YEAR")){ PropertyXOmitYear = PropertyValue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } // Convert the date from YYYY-MM-DD to YYYYMMDD or --MMDD depending on if the // year matches the X-APPLE-OMIT-YEAR value. wxStringTokenizer DateSplit(*wxSPropertySeg2Ptr, wxT("-")); wxString DateProc; wxString FinalDate; DateProc = DateSplit.GetNextToken(); if (DateProc == PropertyXOmitYear){ FinalDate.Append(wxT("--")); } else { FinalDate.Append(DateProc); } DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); DateProc.clear(); DateProc = DateSplit.GetNextToken(); FinalDate.Append(DateProc); wxSPropertyDataOut->Append(FinalDate); } // TZ - Not sure how to process this correctly. So data // is kept as X-VCARD3-TZ for the time being. if (wxSProperty == wxT("TZ")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 4; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("X-VCARD3-TZ"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // ROLE if (wxSProperty == wxT("ROLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 6; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ROLE"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // ORG if (wxSProperty == wxT("ORG")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 5; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("ORG"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // NOTE if (wxSProperty == wxT("NOTE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 6; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("NOTE"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } } // PHOTO if (wxSProperty == wxT("PHOTO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map SplitData; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; int intPrevValue = 7; *wxSPropertyDataNameOut = wxT("PHOTO"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValuesData(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue, &SplitData); } else { SplitValuesData(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue, &SplitData); } wxString wxSMIMEType; wxString wxSEncType; for (std::map::iterator intiter = SplitData.begin(); intiter != SplitData.end(); ++intiter){ PropertyName = intiter->first; PropertyValue = intiter->second; if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){ wxSEncType = wxT("base64"); continue; } if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("PNG")){ wxSMIMEType = wxT("image/png"); continue; } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("JPEG")){ wxSMIMEType = wxT("image/jpeg"); continue; } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("GIF")){ wxSMIMEType = wxT("image/gif"); continue; } else if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type")) && PropertyValue == wxT("BMP")){ wxSMIMEType = wxT("image/bmp"); continue; } else if (PropertyName == wxT("TYPE") || PropertyName == wxT("type")) { wxSMIMEType = wxT("image/unknown"); continue; } // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } wxSPropertyDataOut->Append(wxT("data:")); wxSPropertyDataOut->Append(wxSMIMEType); wxSPropertyDataOut->Append(wxT(";")); wxSPropertyDataOut->Append(wxSEncType); wxSPropertyDataOut->Append(wxT(",")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); } // SOUND if (wxSProperty == wxT("SOUND")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; wxString PropertyXOmitYear; bool FirstToken = TRUE; int intPrevValue = 7; *wxSPropertyDataNameOut = wxT("SOUND"); *VCardV3Value = TRUE; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } wxString wxSMIMEType; wxString wxSEncType; for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); if (PropertyName == wxT("ENCODING") && PropertyValue == wxT("b")){ wxSEncType = wxT("base64"); continue; } if ((PropertyName == wxT("TYPE") || PropertyName == wxT("type"))){ wxSMIMEType = PropertyValue; continue; } intPrevValue = intiter->second; // Process properties. if (PropertyName.IsEmpty()){ continue; } if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); PropertyLockMap->erase(PropertyName); PropertyLockMap->insert(std::make_pair(PropertyName, TRUE)); } } wxSPropertyDataOut->Append(wxT("data:")); wxSPropertyDataOut->Append(wxSMIMEType); wxSPropertyDataOut->Append(wxT(";")); wxSPropertyDataOut->Append(wxSEncType); wxSPropertyDataOut->Append(wxT(",")); wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); } // Look for backward compatability vCard 4.0 properties. // X-VCARD4-FN if (wxSProperty == wxT("X-VCARD4-FN")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); *wxSPropertyDataNameOut = wxT("FN"); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 13; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-N if (wxSProperty == wxT("X-VCARD4-N")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 12; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("N"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-NICKNAME if (wxSProperty == wxT("X-VCARD4-NICKNAME")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 19; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("NICKNAME"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-GENDER if (wxSProperty == wxT("X-VCARD4-GENDER")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 17; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("GENDER"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); //ProcessCaptureStrings(&PropertyValue); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-BDAY if (wxSProperty == wxT("X-VCARD4-BDAY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("BDAY"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ANNIVERSARY if (wxSProperty == wxT("X-VCARD4-ANNIVERSARY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 22; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ANNIVERSARY"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-TZ if (wxSProperty == wxT("X-VCARD4-TZ")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 13; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("TZ"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ADR if (wxSProperty == wxT("X-VCARD4-ADR")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ADR"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-EMAIL if (wxSProperty == wxT("X-VCARD4-EMAIL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("EMAIL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-IMPP if (wxSProperty == wxT("X-VCARD4-IMPP")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("IMPP"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-TEL if (wxSProperty == wxT("X-VCARD4-TEL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("TEL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-LANG if (wxSProperty == wxT("X-VCARD4-LANG")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("LANG"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-GEO if (wxSProperty == wxT("X-VCARD4-GEO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("GEO"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-RELATED if (wxSProperty == wxT("X-VCARD4-RELATED")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 18; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("RELATED"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-URL if (wxSProperty == wxT("X-VCARD4-URL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("URL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-TITLE if (wxSProperty == wxT("X-VCARD4-TITLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("TITLE"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ROLE if (wxSProperty == wxT("X-VCARD4-ROLE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ROLE"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-ORG if (wxSProperty == wxT("X-VCARD4-ORG")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("ORG"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-NOTE if (wxSProperty == wxT("X-VCARD4-NOTE")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("NOTE"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-CATEGORIES if (wxSProperty == wxT("X-VCARD4-CATEGORIES")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 21; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("CATEGORIES"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-PHOTO if (wxSProperty == wxT("X-VCARD4-PHOTO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("PHOTO"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-LOGO if (wxSProperty == wxT("X-VCARD4-LOGO")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 15; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("LOGO"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-SOUND if (wxSProperty == wxT("X-VCARD4-SOUND")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("SOUND"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-CALURI if (wxSProperty == wxT("X-VCARD4-CALURI")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 17; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("CALURI"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-CALADRURI if (wxSProperty == wxT("X-VCARD4-CALADRURI")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 20; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("CALADRURI"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-FBURL if (wxSProperty == wxT("X-VCARD4-FBURL")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 16; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("FBURL"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-KEY if (wxSProperty == wxT("X-VCARD4-KEY")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxT("KEY"); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-VCARD4-VND-* if (wxSProperty.Mid(0, 12) == wxT("X-VCARD4-VND")){ if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 14; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); *wxSPropertyDataNameOut = wxSProperty.Mid(9); } for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-ADDRESSBOOKSERVER-KIND if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-KIND")){ // Process Data. if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 26; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } *wxSPropertyDataNameOut = wxT("KIND"); for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // X-ADDRESSBOOKSERVER-MEMBER if (wxSProperty == wxT("X-ADDRESSBOOKSERVER-MEMBER")){ // Process Data. if (ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Chopped.Len(); } else { intPropertyLen = wxSPropertySeg1Ptr->Len(); } std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; std::map::iterator BIter;; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; int intPrevValue = 28; if (ProcessItemData == TRUE){ SplitValues(&wxSPropertySeg1Chopped, &SplitPoints, &SplitLength, intPrevValue); } else { SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); } *wxSPropertyDataNameOut = wxT("MEMBER"); for (std::map::iterator intiter = SplitPoints.begin(); intiter != SplitPoints.end(); ++intiter){ SLiter = SplitLength.find(intiter->first); if (ProcessItemData == TRUE){ if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Chopped.Mid((intPrevValue), (SLiter->second)); } } else { if (FirstToken == TRUE){ PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue - 1), (SLiter->second)); FirstToken = FALSE; } else { PropertyData = wxSPropertySeg1Ptr->Mid((intPrevValue), (SLiter->second)); } } wxStringTokenizer PropertyElement (PropertyData, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); intPrevValue = intiter->second; // Process properties. // Check if there is a lock on the property value. If there is a lock then // the property value cannot be changed. if (PropertyName.IsEmpty()){ continue; } if (PropertyLockMap->find(PropertyName) == PropertyLockMap->end()){ if (PropertyDataMap->find(PropertyName) == PropertyDataMap->end()){ PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } else { PropertyDataMap->erase(PropertyName); PropertyDataMap->insert(std::make_pair(PropertyName, PropertyValue)); } } } wxSPropertyXVCard4Value->Append(*wxSPropertySeg2Ptr); *XVCardV4Value = TRUE; } // Deal with X-ABLabel specifically. if (wxSProperty == wxT("X-ABLabel") && ProcessItemData == TRUE){ intPropertyLen = wxSPropertySeg1Ptr->Len(); std::map SplitPoints; std::map SplitLength; std::map::iterator SLiter; wxString PropertyData; wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; int intPrevValue = 11; SplitValues(wxSPropertySeg1Ptr, &SplitPoints, &SplitLength, intPrevValue); PropertyDataMap->insert(std::make_pair(wxT("X-ABLabel"), *wxSPropertySeg2Ptr)); } } void vCard34Conv::ProcessCaptureStringsProc(wxString *strCapture){ // Process code for capturing the strings. CaptureString(strCapture, FALSE); } void vCard34Conv::SplitValues(wxString *PropertyLine, std::map *SplitPoints, std::map *SplitLength, int intSize){ // Split the values as required. size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; int intSplitSeek = 0; for (int i = intSize; i <= intPropertyLen; i++){ intSplitSize++; if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ if (intSplitsFound == 0){ SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); } else { SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); intSplitsFound++; intSplitSeek = i; intSplitSize = 0; } } if (intSplitsFound == 0){ SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } else { SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } } void vCard34Conv::SplitValuesData(wxString *PropertyLine, std::map *SplitPoints, std::map *SplitLength, int intSize, std::map *SplitData){ // Split the data values as required. wxString DataStr; wxStringTokenizer PropertyElement; wxString PropertyName; wxString PropertyValue; size_t intPropertyLen = PropertyLine->Len(); int intSplitsFound = 0; int intSplitSize = 0; int intSplitSeek = (intSize - 1); for (int i = intSize; i <= intPropertyLen; i++){ intSplitSize++; if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); } else { DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); } SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); intSplitsFound++; intSplitSeek = (i + 1); intSplitSize = 0; if (!DataStr.IsEmpty()){ PropertyElement.SetString(DataStr, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); SplitData->insert(std::make_pair(PropertyName, PropertyValue)); } DataStr.clear(); PropertyName.clear(); PropertyValue.clear(); } } if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitPoints->insert(std::make_pair(intSplitsFound, (8 + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } else { DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize - 1)); SplitPoints->insert(std::make_pair(intSplitsFound, (intSplitSeek + 1))); SplitLength->insert(std::make_pair(intSplitsFound, intSplitSize)); } if (!DataStr.IsEmpty()){ PropertyElement.SetString(DataStr, wxT("=")); PropertyName = PropertyElement.GetNextToken(); PropertyValue = PropertyElement.GetNextToken(); SplitData->insert(std::make_pair(PropertyName, PropertyValue)); } }