- // Check for backslashes used for commas, newlines and
- // backslashes used for values.
+ // Add data to vCard object.
+
+ // Check for backslashes used for commas, newlines and
+ // backslashes used for values.
- SettingValue.Replace(wxT("\\n"), wxT("\n"));
- SettingValue.Replace(wxT("\\,"), wxT(","));
- SettingValue.Replace(wxT("\\:"), wxT(":"));
- SettingValue.Replace(wxT("\\\\"), wxT("\\"));
+ SettingValue.Replace(wxT("\\n"), wxT("\n"));
+ SettingValue.Replace(wxT("\\,"), wxT(","));
+ SettingValue.Replace(wxT("\\:"), wxT(":"));
+ SettingValue.Replace(wxT("\\\\"), wxT("\\"));
- SettingValue.Replace(wxT("\\"), wxT("\\\\"));
- SettingValue.Replace(wxT("\n"), wxT("\\n"));
- SettingValue.Replace(wxT(","), wxT("\\,"));
- SettingValue.Replace(wxT(":"), wxT("\\:"));
- SettingValue = SettingValue + wxT("\n");
+ SettingValue.Replace(wxT("\\"), wxT("\\\\"));
+ SettingValue.Replace(wxT("\n"), wxT("\\n"));
+ SettingValue.Replace(wxT(","), wxT("\\,"));
+ SettingValue.Replace(wxT(":"), wxT("\\:"));
+ SettingValue = SettingValue + wxT("\n");
- SettingNames.Add(SettingName, 1);
- SettingValues.Add(SettingValue, 1);
+ SettingNames.Add(SettingName, 1);
+ SettingValues.Add(SettingValue, 1);
- // Check data to make sure that it meets the required
- // vCard 4.0 specifications.
-
- if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){
- vCardBegin = TRUE;
- }
+ // Add data to the vCard in raw mode.
+
+ // Check data to make sure that it meets the required
+ // vCard 4.0 specifications.
+
+ if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){
+ vCardBegin = TRUE;
+ }
- SettingNames.Add(SettingName, 1);
- SettingValues.Add(SettingValue, 1);
+ SettingNames.Add(SettingName, 1);
+ SettingValues.Add(SettingValue, 1);
- while (SettingValues[(i + 1)].Mid(0, 1) == wxT(" ") || SettingValues[(i + 1)].Mid(0, 1) == wxT("\t")){
+ while (SettingValues[(i + 1)].Mid(0, 1) == wxT(" ") || SettingValues[(i + 1)].Mid(0, 1) == wxT("\t")){
vCardName NameData;
ArrayvCardOutData NameArray = this->GetByPartial(wxT("N"));
//wxString NameDataGet = NameArray.PropValues[0];
vCardName NameData;
ArrayvCardOutData NameArray = this->GetByPartial(wxT("N"));
//wxString NameDataGet = NameArray.PropValues[0];
- ArrayvCardOutData vCardOutData;
- wxArrayString SettingList;
- wxString SettingValueCurrent;
- wxString SettingValue;
- int SettingNameLen;
- int SettingNameSeek;
- bool FirstToken = TRUE;
+ // Get data from the vCard object based on a partial match.
+
+ ArrayvCardOutData vCardOutData;
+ wxArrayString SettingList;
+ wxString SettingValueCurrent;
+ wxString SettingValue;
+ int SettingNameLen;
+ int SettingNameSeek;
+ bool FirstToken = TRUE;
- while (SettingValues[(i + 1)].Mid(0, 1) == wxT(" ") || SettingValues[(i + 1)].Mid(0, 1) == wxT("\t")){
+ while (SettingValues[(i + 1)].Mid(0, 1) == wxT(" ") || SettingValues[(i + 1)].Mid(0, 1) == wxT("\t")){
- SettingValueCurrent = SettingValues[(i + 1)];
- SettingValueCurrent.Trim(FALSE);
- SettingValueCurrent.Trim(TRUE);
+ SettingValueCurrent = SettingValues[(i + 1)];
+ SettingValueCurrent.Trim(FALSE);
+ SettingValueCurrent.Trim(TRUE);
- //SettingList.Add(SettingNames[SettingNameSeek] + wxT(":") + SettingValue);
- vCardOutData.PropData.Add(SettingNames[SettingNameSeek]);
- vCardOutData.PropValues.Add(SettingValue);
- vCardOutData.PropCount++;
+ //SettingList.Add(SettingNames[SettingNameSeek] + wxT(":") + SettingValue);
+ vCardOutData.PropData.Add(SettingNames[SettingNameSeek]);
+ vCardOutData.PropValues.Add(SettingValue);
+ vCardOutData.PropCount++;
/*for (int i = 0; i < SettingCount; i++){
if (SettingNames[i].Mid(0, SettingNameLen) == SettingName){
/*for (int i = 0; i < SettingCount; i++){
if (SettingNames[i].Mid(0, SettingNameLen) == SettingName){
- if ((intLineSeek == intDivider && FirstLine == TRUE) ||
- (intLineSeek == (intDivider - 1) && FirstLine == FALSE)){
+ if ((intLineSeek == intDivider && FirstLine == TRUE) ||
+ (intLineSeek == (intDivider - 1) && FirstLine == FALSE)){
- SettingLine.insert(intSeek, wxT("\r\n "));
- intSeek = intSeek + 3;
- SettingLineLen = SettingLineLen + 3;
- intLineSeek = 0;
- intPrevLine = intSeek;
- FirstLine = FALSE;
+ SettingLine.insert(intSeek, wxT("\r\n "));
+ intSeek = intSeek + 3;
+ SettingLineLen = SettingLineLen + 3;
+ intLineSeek = 0;
+ FirstLine = FALSE;
- }
-
- /*
-
- for (int x = 0; x < intTimes; x++){
-
- if (x == 0){
- SettingLine.insert((intDivider - 1), wxT("\r\n "));
- } else if (x == intTimes){
-
- } else {
- if (x < intDivider){
- SettingLine.insert((intDivider * (x+1)) + (x * 3), wxT("\r\n "));
- // Check if we are using wxWidgets version 2.8 or less and
- // execute the required command accordingly.
+ // Check if we are using wxWidgets version 2.8 or less and
+ // execute the required command accordingly.
- wxString wxSPropertyNextLine;
- wxString wxSProperty;
- wxString wxSPropertySeg1;
- wxString wxSPropertySeg2;
+ wxString wxSPropertyNextLine;
+ wxString wxSProperty;
+ wxString wxSPropertySeg1;
+ wxString wxSPropertySeg2;
- bool FoundBegin = FALSE;
- bool FoundEnd = FALSE;
- bool FirstContact = TRUE;
- wxString FirstContactData;
- wxString ContactData;
- int ContactCount = 0;
+ bool FoundBegin = FALSE;
+ bool FirstContact = TRUE;
+ wxString FirstContactData;
+ wxString ContactData;
+ int ContactCount = 0;
- FirstContactData.Append(ContactLine + wxT("\r\n"));
- ContactData.Append(ContactLine + wxT("\r\n"));
+ FirstContactData.Append(ContactLine + wxT("\r\n"));
+ ContactData.Append(ContactLine + wxT("\r\n"));
- std::map<int, wxString> ContactFileLines;
- std::map<int, wxString>::iterator striter;
+ std::map<int, wxString> ContactFileLines;
+ std::map<int, wxString>::iterator striter;
- ContactLine = wSTFirstContactLines.GetNextToken();
- ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
- ContactLineSeek++;
+ ContactLine = wSTFirstContactLines.GetNextToken();
+ ContactFileLines.insert(std::make_pair(ContactLineSeek, ContactLine));
+ ContactLineSeek++;
- for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
- iter != ContactFileLines.end(); ++iter){
+ for (std::map<int,wxString>::iterator iter = ContactFileLines.begin();
+ iter != ContactFileLines.end(); ++iter){
- // Check if there is extra data on the next line
- // (indicated by space or tab at the start) and add data.
+ // Check if there is extra data on the next line
+ // (indicated by space or tab at the start) and add data.
+ if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
+
+ wxSPropertyNextLine.Remove(0, 1);
+ //wxSPropertyNextLine.Trim(FALSE);
+ //ContactLine.Trim();
+ ContactLine.Append(wxSPropertyNextLine);
- if (wxSPropertyNextLine.Mid(0, 1) == wxT(" ") || wxSPropertyNextLine.Mid(0, 1) == wxT("\t")){
-
- wxSPropertyNextLine.Remove(0, 1);
- //wxSPropertyNextLine.Trim(FALSE);
- //ContactLine.Trim();
- ContactLine.Append(wxSPropertyNextLine);
-
- } else {
- if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
+ if ((ContactLine.Mid(i, 1) == wxT(";") || ContactLine.Mid(i, 1) == wxT(":")) && PropertyFind == TRUE){
- if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
+ if (ContactLine.Mid(i, 1) == wxT(":") && ContactLine.Mid((i - 1), 1) != wxT("\\") && QuoteMode == FALSE){
- wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
- wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
+ wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
+ wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
- if ((intLineSeek == intDivider && FirstLine == TRUE) ||
- (intLineSeek == (intDivider - 1) && FirstLine == FALSE)){
+ if ((intLineSeek == intDivider && FirstLine == TRUE) ||
+ (intLineSeek == (intDivider - 1) && FirstLine == FALSE)){
- SettingLine.insert(intSeek, wxT("\r\n "));
- intSeek = intSeek + 3;
- SettingLineLen = SettingLineLen + 3;
- intLineSeek = 0;
- intPrevLine = intSeek;
- FirstLine = FALSE;
+ SettingLine.insert(intSeek, wxT("\r\n "));
+ intSeek = intSeek + 3;
+ SettingLineLen = SettingLineLen + 3;
+ intLineSeek = 0;
+ FirstLine = FALSE;
- // Check for backslashes used for commas, newlines and
- // backslashes used for values.
+ // Check for backslashes used for commas, newlines and
+ // backslashes used for values.
- SettingValue.Replace(wxT("\\n"), wxT("\n"));
- SettingValue.Replace(wxT("\\,"), wxT(","));
- SettingValue.Replace(wxT("\\;"), wxT(";"));
- SettingValue.Replace(wxT("\\\\"), wxT("\\"));
+ SettingValue.Replace(wxT("\\n"), wxT("\n"));
+ SettingValue.Replace(wxT("\\,"), wxT(","));
+ SettingValue.Replace(wxT("\\;"), wxT(";"));
+ SettingValue.Replace(wxT("\\\\"), wxT("\\"));
- SettingValue.Replace(wxT("\\"), wxT("\\\\"));
- SettingValue.Replace(wxT("\n"), wxT("\\n"));
- SettingValue.Replace(wxT(","), wxT("\\,"));
- SettingValue.Replace(wxT(";"), wxT("\\;"));
- SettingValue = SettingValue + wxT("\n");
+ SettingValue.Replace(wxT("\\"), wxT("\\\\"));
+ SettingValue.Replace(wxT("\n"), wxT("\\n"));
+ SettingValue.Replace(wxT(","), wxT("\\,"));
+ SettingValue.Replace(wxT(";"), wxT("\\;"));
+ SettingValue = SettingValue + wxT("\n");