1 #include "frmContactEditor.h"
3 void frmContactEditor::LoadGender(wxString wxSPropertySeg1, wxString wxSPropertySeg2, bool *GenderProcessed, vCard *ContactData){
5 std::map<int, int> SplitPoints;
6 std::map<int, int> SplitLength;
7 std::map<int, int>::iterator SLiter;
10 wxString PropertyValue;
11 wxString PropertyTokens;
12 bool FirstToken = TRUE;
15 SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
19 for (std::map<int, int>::iterator intiter = SplitPoints.begin();
20 intiter != SplitPoints.end(); ++intiter){
22 SLiter = SplitLength.find(intiter->first);
24 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
26 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
27 PropertyName = PropertyElement.GetNextToken();
28 PropertyValue = PropertyElement.GetNextToken();
30 intPrevValue = intiter->second;
32 // Process properties.
34 size_t intPropertyValueLen = PropertyValue.Len();
36 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
39 PropertyValue.RemoveLast();
43 if (PropertyValue.Mid(0, 1) == wxT("\"")){
45 PropertyValue.Remove(0, 1);
49 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
51 if (FirstToken == TRUE){
53 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
58 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
66 wxStringTokenizer GenderDetails (wxSPropertySeg2, wxT(";"));
68 wxString GenderComponent;
69 wxString GenderIdentity;
71 if (GenderDetails.CountTokens() >= 2){
73 GenderComponent = GenderDetails.GetNextToken();
74 GenderIdentity = GenderDetails.GetString();
76 ProcessCaptureStrings(&GenderIdentity);
78 txtGenderDescription->SetValue(ContactData->Convert(GenderIdentity, TRUE));
82 GenderComponent = GenderDetails.GetNextToken();
86 if (GenderComponent == wxT("M")){
90 cmbGender->SetSelection(1);
92 } else if (GenderComponent == wxT("F")){
96 cmbGender->SetSelection(2);
98 } else if (GenderComponent == wxT("O")){
102 cmbGender->SetSelection(3);
104 } else if (GenderComponent == wxT("N")){
106 // Gender is None/Not Applicable.
108 cmbGender->SetSelection(4);
110 } else if (GenderComponent == wxT("U")){
112 // Gender is Unknown.
114 cmbGender->SetSelection(5);
118 GenderTokens = PropertyTokens;
119 *GenderProcessed = TRUE;