Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Split frmContactEditor-Load.cpp into 24 files to make it more manageable.
[xestiaab/.git] / source / contacteditor / frmContactEditor-LoadGender.cpp
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;                    
8         wxString PropertyData;
9         wxString PropertyName;
10         wxString PropertyValue;
11         wxString PropertyTokens;
12         bool FirstToken = TRUE;
13         int intPrevValue = 8;
15         SplitValues(&wxSPropertySeg1, &SplitPoints, &SplitLength, intPrevValue);
16         
17         intPrevValue = 7;                       
18         
19         for (std::map<int, int>::iterator intiter = SplitPoints.begin(); 
20         intiter != SplitPoints.end(); ++intiter){
21         
22                 SLiter = SplitLength.find(intiter->first);
23         
24                 PropertyData = wxSPropertySeg1.Mid(intPrevValue, (SLiter->second));
25                 
26                 wxStringTokenizer PropertyElement (PropertyData, wxT("="));
27                 PropertyName = PropertyElement.GetNextToken();                          
28                 PropertyValue = PropertyElement.GetNextToken();
29                 
30                 intPrevValue = intiter->second;
31                 
32                 // Process properties.
33                 
34                 size_t intPropertyValueLen = PropertyValue.Len();
35                 
36                 if (PropertyValue.Mid((intPropertyValueLen - 1), 1) == wxT("\"")){
37                         
38                         PropertyValue.Trim();
39                         PropertyValue.RemoveLast();
40                         
41                 }                               
42                 
43                 if (PropertyValue.Mid(0, 1) == wxT("\"")){
44                         
45                         PropertyValue.Remove(0, 1);
46                         
47                 }                               
48                 
49                 if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){
51                         if (FirstToken == TRUE){
52         
53                                 PropertyTokens.Append(PropertyName + wxT("=") + PropertyValue);
54                                 FirstToken = FALSE;
55         
56                         } else {
57         
58                                 PropertyTokens.Append(wxT(";") + PropertyName + wxT("=") + PropertyValue);
59         
60                         }
62                 }
63         
64         }       
66         wxStringTokenizer GenderDetails (wxSPropertySeg2, wxT(";"));
67         
68         wxString GenderComponent;
69         wxString GenderIdentity;
70         
71         if (GenderDetails.CountTokens() >= 2){
72         
73                 GenderComponent = GenderDetails.GetNextToken();
74                 GenderIdentity = GenderDetails.GetString();
75         
76                 ProcessCaptureStrings(&GenderIdentity);
77         
78                 txtGenderDescription->SetValue(ContactData->Convert(GenderIdentity, TRUE));
79                                                 
80         } else {
81         
82                 GenderComponent = GenderDetails.GetNextToken();
83         
84         }
85                 
86         if (GenderComponent == wxT("M")){
87                 
88                 // Gender is Male.
89                         
90                 cmbGender->SetSelection(1);
91                 
92         } else if (GenderComponent == wxT("F")){
93                 
94                 // Gender is Female.
95                         
96                 cmbGender->SetSelection(2);                                     
97                 
98         } else if (GenderComponent == wxT("O")){
99                 
100                 // Gender is Other.
101                         
102                 cmbGender->SetSelection(3);
103                 
104         } else if (GenderComponent == wxT("N")){
105                 
106                 // Gender is None/Not Applicable.
107                 
108                 cmbGender->SetSelection(4);                                     
109                 
110         } else if (GenderComponent == wxT("U")){
111                 
112                 // Gender is Unknown.
113                         
114                 cmbGender->SetSelection(5);                                     
115                 
116         }
117         
118         GenderTokens = PropertyTokens;
119         *GenderProcessed = TRUE;
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy