From 2f1132be113a9903332a514c853a5b4f6fd7636a Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 14 Mar 2016 22:49:18 +0000 Subject: [PATCH] Indented code properly in vcard/vcard34conv.cpp --- source/vcard/vcard34conv.cpp | 135 +++++++++++++++++++++++++++-------- 1 file changed, 105 insertions(+), 30 deletions(-) diff --git a/source/vcard/vcard34conv.cpp b/source/vcard/vcard34conv.cpp index 4faa514..4cccfa3 100644 --- a/source/vcard/vcard34conv.cpp +++ b/source/vcard/vcard34conv.cpp @@ -33,11 +33,13 @@ // RFC 6350 specification. vCard34Conv::vCard34Conv(){ - vCardBegin = FALSE; - vCardEnd = FALSE; - vCardFN = FALSE; - vCardVersion = 0.0; - SettingCount = 0; + + vCardBegin = FALSE; + vCardEnd = FALSE; + vCardFN = FALSE; + vCardVersion = 0.0; + SettingCount = 0; + } void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, @@ -155,31 +157,43 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 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. @@ -288,25 +302,35 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 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. @@ -413,20 +437,28 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 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. @@ -555,24 +587,34 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 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. @@ -681,22 +723,30 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 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. @@ -704,53 +754,68 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, // 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()){ @@ -916,7 +981,9 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, intPrevValue = intiter->second; if (PropertyName == wxT("type") && PropertyValue == wxT("pref")){ + continue; + } // Process properties. @@ -1023,20 +1090,28 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, 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. @@ -1293,7 +1368,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyValue; wxString PropertyTokens; bool FirstToken = TRUE; - int intPrevValue = 3; + int intPrevValue = 3; wxSPropertyDataOut->Append(*wxSPropertySeg2Ptr); *wxSPropertyDataNameOut = wxT("N"); @@ -2735,7 +2810,7 @@ void vCard34Conv::ConvertV4PropertyProc(wxString *wxSPropertyName, wxString PropertyName; wxString PropertyValue; wxString PropertyTokens; - bool FirstToken = TRUE; + bool FirstToken = TRUE; int intPrevValue = 12; if (ProcessItemData == TRUE){ @@ -5899,21 +5974,21 @@ void vCard34Conv::SplitValues(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); - } else { + } else { - SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); + SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize - 1))); - } + } - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); - intSplitsFound++; - intSplitSeek = i; - intSplitSize = 0; + intSplitsFound++; + intSplitSeek = i; + intSplitSize = 0; } @@ -5955,7 +6030,7 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, if (PropertyLine->Mid(i, 1) == wxT(";") && PropertyLine->Mid((i - 1), 1) != wxT("\\")){ - if (intSplitsFound == 0){ + if (intSplitsFound == 0){ DataStr = PropertyLine->Mid(intSplitSeek, (intSplitSize)); SplitLength->insert(std::make_pair(intSplitsFound, (intSplitSize))); @@ -5967,24 +6042,24 @@ void vCard34Conv::SplitValuesData(wxString *PropertyLine, } - SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); + SplitPoints->insert(std::make_pair(intSplitsFound, (i + 1))); - intSplitsFound++; - intSplitSeek = (i + 1); - intSplitSize = 0; + intSplitsFound++; + intSplitSeek = (i + 1); + intSplitSize = 0; - if (!DataStr.IsEmpty()){ + if (!DataStr.IsEmpty()){ - PropertyElement.SetString(DataStr, wxT("=")); - PropertyName = PropertyElement.GetNextToken(); - PropertyValue = PropertyElement.GetNextToken(); - SplitData->insert(std::make_pair(PropertyName, PropertyValue)); + PropertyElement.SetString(DataStr, wxT("=")); + PropertyName = PropertyElement.GetNextToken(); + PropertyValue = PropertyElement.GetNextToken(); + SplitData->insert(std::make_pair(PropertyName, PropertyValue)); - } + } - DataStr.clear(); - PropertyName.clear(); - PropertyValue.clear(); + DataStr.clear(); + PropertyName.clear(); + PropertyValue.clear(); } -- 2.39.5