Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Indented code properly in vcard/vcard.cpp
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 15 Mar 2016 22:52:27 +0000 (22:52 +0000)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Tue, 15 Mar 2016 22:52:27 +0000 (22:52 +0000)
source/vcard/vcard.cpp

index cb33358..a25f2dc 100644 (file)
 // RFC 6350 specification.
 
 vCard::vCard(){
-    vCardBegin = FALSE;
-    vCardEnd = FALSE;
-    vCardFN = FALSE;
-    vCardVersion = 0.0;
-    SettingCount = 0;
+       
+       vCardBegin = FALSE;
+       vCardEnd = FALSE;
+       vCardFN = FALSE;
+       vCardVersion = 0.0;
+       SettingCount = 0;
+       
 }
 
 void vCard::Add(wxString SettingName, wxString SettingValue, bool ReplaceMode){  
     
-    // Check for backslashes used for commas, newlines and
-    // backslashes used for values.
+       // Check for backslashes used for commas, newlines and
+       // backslashes used for values.
     
-    if (ReplaceMode == TRUE){
+       if (ReplaceMode == TRUE){
     
-       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("\\"));
     
-    } else {
+       } else {
 
-       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");
     
-    }
+       }
   
-    // Check data to make sure that it meets the required
-    // vCard 4.0 specifications.
+       // Check data to make sure that it meets the required
+       // vCard 4.0 specifications.
     
        if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){
                vCardBegin = TRUE;
@@ -82,87 +84,92 @@ void vCard::Add(wxString SettingName, wxString SettingValue, bool ReplaceMode){
                vCardVersion = 2.0;
        }
     
-    SettingValue.Trim();    
+       SettingValue.Trim();    
     
-    if (SettingValue.Right(2) != wxT("\r\n")){
+       if (SettingValue.Right(2) != wxT("\r\n")){
     
-       SettingValue.Append(wxT("\r\n"));
+               SettingValue.Append(wxT("\r\n"));
     
-    }
+       }
     
-    SettingNames.Add(SettingName, 1);
-    SettingValues.Add(SettingValue, 1);      
+       SettingNames.Add(SettingName, 1);
+       SettingValues.Add(SettingValue, 1);      
     
-    ++SettingCount;
+       ++SettingCount;
+       
 }
 
 void vCard::AddRaw(wxString SettingName, wxString SettingValue){  
   
-    // Check data to make sure that it meets the required
-    // vCard 4.0 specifications.
-    
-    if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){
-       vCardBegin = TRUE;
-    }
+       // Check data to make sure that it meets the required
+       // vCard 4.0 specifications.
+       
+       if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){
+               vCardBegin = TRUE;
+       }
     
-    if (SettingName == wxT("END") && SettingValue == wxT("VCARD")){
-       vCardEnd = TRUE;
-    }
+       if (SettingName == wxT("END") && SettingValue == wxT("VCARD")){
+               vCardEnd = TRUE;
+       }
     
-    if (SettingName.Mid(0,2) == wxT("FN")){
-       vCardFN = TRUE;
-    }
+       if (SettingName.Mid(0,2) == wxT("FN")){
+               vCardFN = TRUE;
+       }
     
-    if (SettingName == wxT("VERSION") && SettingValue == wxT("4.0")){   
-       vCardVersion = 4.0;
-    }
+       if (SettingName == wxT("VERSION") && SettingValue == wxT("4.0")){   
+               vCardVersion = 4.0;
+       }
 
-    if (SettingName == wxT("VERSION") && SettingValue == wxT("3.0")){   
-       vCardVersion = 3.0;
-    }
+       if (SettingName == wxT("VERSION") && SettingValue == wxT("3.0")){   
+               vCardVersion = 3.0;
+       }
     
-    if (SettingName == wxT("VERSION") && SettingValue == wxT("3.0")){   
-       vCardVersion = 2.0;
-    }
+       if (SettingName == wxT("VERSION") && SettingValue == wxT("3.0")){   
+               vCardVersion = 2.0;
+       }
     
-    SettingValue.Trim();
+       SettingValue.Trim();
     
-    if (SettingValue.Right(2) != wxT("\r\n")){
+       if (SettingValue.Right(2) != wxT("\r\n")){
     
-       SettingValue.Append(wxT("\r\n"));
+               SettingValue.Append(wxT("\r\n"));
     
-    }
+       }
         
-    SettingNames.Add(SettingName, 1);
-    SettingValues.Add(SettingValue, 1);      
+       SettingNames.Add(SettingName, 1);
+       SettingValues.Add(SettingValue, 1);      
     
-    ++SettingCount;
+       ++SettingCount;
+       
 }
 
 wxString vCard::Get(wxString SettingName){
   
-    wxString SettingValue;
+       wxString SettingValue;
     
-    // Look for the setting name.
+       // Look for the setting name.
     
-    for (int i = 0; i < SettingCount; i++){
+       for (int i = 0; i < SettingCount; i++){
       
-       if (SettingNames[i] == SettingName){
+               if (SettingNames[i] == SettingName){
        
-           SettingValue = SettingValues[i];
-           SettingValue.Trim(TRUE);
+                       SettingValue = SettingValues[i];
+                       SettingValue.Trim(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")){
                
-               SettingValue.Trim();
-               SettingValue.Append(SettingValues[(i + 1)]);
+                               SettingValue.Trim();
+                               SettingValue.Append(SettingValues[(i + 1)]);
                
-               i++;
-           }
+                               i++;
+                       
+                       }
            
-           return SettingValue;
+                       return SettingValue;
+               
+               }
+       
        }
-    }
 
        return wxEmptyString;
 
@@ -263,50 +270,50 @@ vCardName vCard::GetName(){
 
 ArrayvCardOutData vCard::GetByPartial(wxString SettingName){
 
-    ArrayvCardOutData vCardOutData;
-    wxArrayString SettingList;
-    wxString SettingValueCurrent;
-    wxString SettingValue;
-    int SettingNameLen;
-    int SettingNameSeek;
-    bool FirstToken = TRUE;
+       ArrayvCardOutData vCardOutData;
+       wxArrayString SettingList;
+       wxString SettingValueCurrent;
+       wxString SettingValue;
+       int SettingNameLen;
+       int SettingNameSeek;
+       bool FirstToken = TRUE;
     
-    SettingNameLen = SettingName.Len();
-
-    for (int i = 0; i < SettingCount; i++){
+       SettingNameLen = SettingName.Len();
+       
+       for (int i = 0; i < SettingCount; i++){
     
-       if (SettingNames[i].Mid(0, SettingNameLen) == SettingName){
+               if (SettingNames[i].Mid(0, SettingNameLen) == SettingName){
            
-           SettingValue = SettingValues[i];
-           SettingNameSeek = i;            
+                       SettingValue = SettingValues[i];
+                       SettingNameSeek = i;        
            
-           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")){
                
-               if (FirstToken == TRUE){
+                       if (FirstToken == TRUE){
                
-                       SettingValue.Trim(FALSE);
-                       SettingValue.Trim(TRUE);                                
-                       FirstToken = FALSE;
+                               SettingValue.Trim(FALSE);
+                               SettingValue.Trim(TRUE);                                
+                               FirstToken = FALSE;
                
-               }
+                       }
                
-               SettingValueCurrent = SettingValues[(i + 1)];
-               SettingValueCurrent.Trim(FALSE);
-               SettingValueCurrent.Trim(TRUE);         
+                       SettingValueCurrent = SettingValues[(i + 1)];
+                       SettingValueCurrent.Trim(FALSE);
+                       SettingValueCurrent.Trim(TRUE);         
                
-               SettingValue.Append(SettingValueCurrent);
+                       SettingValue.Append(SettingValueCurrent);
                
-               i++;
+                       i++;
                
-           }
+               }
            
-           //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){
@@ -333,62 +340,64 @@ ArrayvCardOutData vCard::GetByPartial(wxString SettingName){
        }
     }*/
     
-    return vCardOutData;
+       return vCardOutData;
 
 }
 
 wxString vCard::GetById(int id){
+       
        // Unimplemented.
        return wxT("");
+       
 }
 
 int vCard::WriteFile(wxString WriteFilename){
 
-    // Open the file and begin writing data into the file.
+       // Open the file and begin writing data into the file.
     
-    wxString SettingName;
-    wxString SettingValue;
-    wxString SettingLine;
+       wxString SettingName;
+       wxString SettingValue;
+       wxString SettingLine;
     
-    SettingCount = SettingNames.GetCount();
+       SettingCount = SettingNames.GetCount();
     
-    wxFile ContactFile;
-    if (ContactFile.Create(WriteFilename, TRUE, wxS_DEFAULT) == FALSE){
-       return 1;
-    }
+       wxFile ContactFile;
+       if (ContactFile.Create(WriteFilename, TRUE, wxS_DEFAULT) == FALSE){
+               return 1;
+       }
     
-    for (int i = 0; i < SettingCount; i++){
+       for (int i = 0; i < SettingCount; i++){
     
-       SettingLine = SettingNames[i] + wxT(":") + SettingValues[i];
+               SettingLine = SettingNames[i] + wxT(":") + SettingValues[i];
     
-       int SettingLineLen = SettingLine.Len();
-       int intDivider = 74;
-       int intTimes = floor((SettingLine.Len() / intDivider));
-       int intSeek = 0;
-       int intLineSeek = 0;
-       int intPrevLine;
-       bool FirstLine = TRUE;
+               int SettingLineLen = SettingLine.Len();
+               int intDivider = 74;
+               int intTimes = floor((SettingLine.Len() / intDivider));
+               int intSeek = 0;
+               int intLineSeek = 0;
+               int intPrevLine;
+               bool FirstLine = TRUE;
     
-       // Remember to round down the calculation.
+               // Remember to round down the calculation.
 
-       while (intSeek < SettingLineLen){
+               while (intSeek < SettingLineLen){
        
-               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;
+                               intPrevLine = intSeek;
+                               FirstLine = FALSE;
                
-               }
+                       }
        
-               intSeek++;
-               intLineSeek++;
+                       intSeek++;
+                       intLineSeek++;
        
-       }
+               }
 
        /*
 
@@ -410,44 +419,44 @@ int vCard::WriteFile(wxString WriteFilename){
        
        */
        
-       ContactFile.Write(SettingLine);
+               ContactFile.Write(SettingLine);
        
-    }
+       }
     
-    ContactFile.Close();
+       ContactFile.Close();
 
-    return 0;
+       return 0;
 
 }
 
 int vCard::LoadFile(wxString LoadFilename){
 
-    wxFFile ContactFile;
+       wxFFile ContactFile;
   
-    wxString wxSContactString;
+       wxString wxSContactString;
   
-    vCardFilename = LoadFilename;
+       vCardFilename = LoadFilename;
        
     // Check if we are using wxWidgets version 2.8 or less and
     // execute the required command accordingly.
     
 #if wxABI_VERSION < 20900
-    ContactFile.Open(LoadFilename.c_str(), wxT("r"));
+       ContactFile.Open(LoadFilename.c_str(), wxT("r"));
 #else
-    ContactFile.Open(LoadFilename, wxT("r"));
+       ContactFile.Open(LoadFilename, wxT("r"));
 #endif 
        
-    if (ContactFile.IsOpened() == FALSE){
+       if (ContactFile.IsOpened() == FALSE){
        
                return 1;
        
-    }
+       }
        
-    ContactFile.ReadAll(&wxSContactString, wxConvAuto());
+       ContactFile.ReadAll(&wxSContactString, wxConvAuto());
     
-    ContactFile.Close();
+       ContactFile.Close();
     
-    ProcessString(&wxSContactString);
+       ProcessString(&wxSContactString);
 
        return 0;
 
@@ -455,7 +464,7 @@ int vCard::LoadFile(wxString LoadFilename){
 
 int vCard::LoadString(wxString ContactData){
 
-    ProcessString(&ContactData);
+       ProcessString(&ContactData);
 
        return 0;
 
@@ -463,305 +472,309 @@ int vCard::LoadString(wxString ContactData){
 
 void vCard::ProcessString(wxString *ContactDataInc){
 
-    // Split the vCards (if there are more than one vCard in the file).
+       // Split the vCards (if there are more than one vCard in the file).
 
-    wxString ContactLine;
+       wxString ContactLine;
 
-    int ContactLineLen;
-    bool ExtraLineSeek = FALSE;
-    int QuoteBreakPoint = 0;
+       int ContactLineLen;
+       bool ExtraLineSeek = FALSE;
+       int QuoteBreakPoint = 0;
     
-    bool PropertyFind = FALSE;
-    bool QuoteMode = FALSE;
+       bool PropertyFind = FALSE;
+       bool QuoteMode = FALSE;
    
-    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 FoundEnd = FALSE;
+       bool FirstContact = TRUE;
+       wxString FirstContactData;
+       wxString ContactData;
+       int ContactCount = 0;
     
-    wxStringTokenizer wSTContactFileLines(*ContactDataInc, wxT("\r\n"));
+       wxStringTokenizer wSTContactFileLines(*ContactDataInc, wxT("\r\n"));
     
-    while(wSTContactFileLines.HasMoreTokens() == TRUE){
+       while(wSTContactFileLines.HasMoreTokens() == TRUE){
     
-       ContactLine = wSTContactFileLines.GetNextToken();
+               ContactLine = wSTContactFileLines.GetNextToken();
        
-       if (ContactLine == wxT("BEGIN:VCARD")){
+               if (ContactLine == wxT("BEGIN:VCARD")){
                
-               if (FoundBegin == TRUE){
+                       if (FoundBegin == TRUE){
                
-                       // No END:VCARD was found so discard current data.
+                               // No END:VCARD was found so discard current data.
                        
-                       ContactData.Clear();
+                               ContactData.Clear();
                
-                       if (FirstContact == TRUE){
+                               if (FirstContact == TRUE){
                        
-                               FirstContactData.Clear();
+                                       FirstContactData.Clear();
                        
-                       }
+                               }
                
-               }
+                       }
                
-               FoundBegin = TRUE;
+                       FoundBegin = TRUE;
                
-               FirstContactData.Append(ContactLine + wxT("\r\n"));
-               ContactData.Append(ContactLine + wxT("\r\n"));
+                       FirstContactData.Append(ContactLine + wxT("\r\n"));
+                       ContactData.Append(ContactLine + wxT("\r\n"));
                
-       } else if (ContactLine == wxT("END:VCARD") && FoundBegin == TRUE){
+               } else if (ContactLine == wxT("END:VCARD") && FoundBegin == TRUE){
        
-               if (FirstContact == TRUE){
+                       if (FirstContact == TRUE){
                
-                       FirstContact = FALSE;
-                       FirstContactData.Append(ContactLine + wxT("\r\n"));
+                               FirstContact = FALSE;
+                               FirstContactData.Append(ContactLine + wxT("\r\n"));
                
-               }
+                       }
                
-               ContactData.Append(ContactLine + wxT("\r\n"));
+                       ContactData.Append(ContactLine + wxT("\r\n"));
                                
-               Cards.insert(std::make_pair(ContactCount, ContactData));
+                       Cards.insert(std::make_pair(ContactCount, ContactData));
        
-               ContactCount++;
+                       ContactCount++;
        
-       } else if (FoundBegin == TRUE){
+               } else if (FoundBegin == TRUE){
        
-               if (FirstContact == TRUE){
+                       if (FirstContact == TRUE){
                
-                       FirstContactData.Append(ContactLine + wxT("\r\n"));
+                               FirstContactData.Append(ContactLine + wxT("\r\n"));
                
-               }
+                       }
                
-               ContactData.Append(ContactLine + wxT("\r\n"));
+                       ContactData.Append(ContactLine + wxT("\r\n"));
        
-       }
+               }
     
-    }
+       }
 
-    ContactLine.Clear();
+       ContactLine.Clear();
     
-    // Split the lines.
+       // Split the lines.
        
-    std::map<int, wxString> ContactFileLines;
-    std::map<int, wxString>::iterator striter;
+       std::map<int, wxString> ContactFileLines;
+       std::map<int, wxString>::iterator striter;
        
-    wxStringTokenizer wSTFirstContactLines(FirstContactData, wxT("\r\n"));
+       wxStringTokenizer wSTFirstContactLines(FirstContactData, wxT("\r\n"));
 
-    int ContactLineSeek = 0;
+       int ContactLineSeek = 0;
 
-    while (wSTFirstContactLines.HasMoreTokens() == TRUE){
+       while (wSTFirstContactLines.HasMoreTokens() == TRUE){
 
-       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){
 
-       // Find the colon which splits the start bit from the data part.
+               // Find the colon which splits the start bit from the data part.
        
-       ContactLine = iter->second;
+               ContactLine = iter->second;
        
-       while (ExtraLineSeek == TRUE){
+               while (ExtraLineSeek == TRUE){
        
-           // 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.
        
-           iter++;
+                       iter++;
                
-           if (iter == ContactFileLines.end()){
+                       if (iter == ContactFileLines.end()){
                
-               iter--;
-               break;
+                               iter--;
+                               break;
                
-           }                   
+                       }
        
-           wxSPropertyNextLine = iter->second;
+                       wxSPropertyNextLine = iter->second;
                
+                       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 {
+                       } else {
                
-               iter--;
-               ExtraLineSeek = FALSE;
+                               iter--;
+                               ExtraLineSeek = FALSE;
                
-           }
+                       }
        
-       }
+               }
 
-       ContactLineLen = ContactLine.Len();
+               ContactLineLen = ContactLine.Len();
        
-       // Make sure we are not in quotation mode.
-       // Make sure colon does not have \ or \\ before it.
+               // Make sure we are not in quotation mode.
+               // Make sure colon does not have \ or \\ before it.
        
-       for (int i = 0; i <= ContactLineLen; i++){
+               for (int i = 0; i <= ContactLineLen; i++){
        
-           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){
                
-                       PropertyFind = FALSE;
+                               PropertyFind = FALSE;
                
-           } else if (PropertyFind == TRUE){
+                       } else if (PropertyFind == TRUE){
                
-                       wxSProperty.Append(ContactLine.Mid(i, 1));
+                               wxSProperty.Append(ContactLine.Mid(i, 1));
                
-           }           
+                       }               
        
-           if (ContactLine.Mid(i, 1) == wxT("\"")){
+                       if (ContactLine.Mid(i, 1) == wxT("\"")){
                
-               if (QuoteMode == TRUE){
+                               if (QuoteMode == TRUE){
                        
-                   QuoteMode = FALSE;
+                                       QuoteMode = FALSE;
                        
-               } else {
+                               } else {
                
-                   QuoteMode = TRUE;
+                                       QuoteMode = 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){
                
-               QuoteBreakPoint = i;
-               break;
+                               QuoteBreakPoint = i;
+                               break;
                
-           }
+                       }
        
-       }
+               }
        
-       // Split that line at the point into two variables (ignore the colon).
+               // Split that line at the point into two variables (ignore the colon).
        
-       wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
-       wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
+               wxSPropertySeg1 = ContactLine.Mid(0, QuoteBreakPoint);
+               wxSPropertySeg2 = ContactLine.Mid((QuoteBreakPoint + 1));
        
-       // Insert both into the vCard data file.
+               // Insert both into the vCard data file.
        
-       AddRaw(wxSPropertySeg1, wxSPropertySeg2);
+               AddRaw(wxSPropertySeg1, wxSPropertySeg2);
        
-       QuoteMode = FALSE;
-       PropertyFind = TRUE;
-       ExtraLineSeek = TRUE;
-       ContactLineLen = 0;
-       QuoteBreakPoint = 0;
-       ContactLine.Clear();
-       wxSProperty.Clear();
+               QuoteMode = FALSE;
+               PropertyFind = TRUE;
+               ExtraLineSeek = TRUE;
+               ContactLineLen = 0;
+               QuoteBreakPoint = 0;
+               ContactLine.Clear();
+               wxSProperty.Clear();
        
-    }
+       }
 
 
 }
 
 wxString vCard::WriteString(){
 
-    // Open the file and begin writing data into the file.
+       // Open the file and begin writing data into the file.
     
-    wxString SettingName;
-    wxString SettingValue;
-    wxString SettingLine;
-    wxString SettingFinal;
+       wxString SettingName;
+       wxString SettingValue;
+       wxString SettingLine;
+       wxString SettingFinal;
     
-    SettingCount = SettingNames.GetCount();
+       SettingCount = SettingNames.GetCount();
     
-    for (int i = 0; i < SettingCount; i++){
+       for (int i = 0; i < SettingCount; i++){
     
-       SettingLine = SettingNames[i] + wxT(":") + SettingValues[i];
+               SettingLine = SettingNames[i] + wxT(":") + SettingValues[i];
     
-       int SettingLineLen = SettingLine.Len();
-       int intDivider = 74;
-       int intTimes = floor((SettingLine.Len() / intDivider));
-       int intSeek = 0;
-       int intLineSeek = 0;
-       int intPrevLine;
-       bool FirstLine = TRUE;
+               int SettingLineLen = SettingLine.Len();
+               int intDivider = 74;
+               int intTimes = floor((SettingLine.Len() / intDivider));
+               int intSeek = 0;
+               int intLineSeek = 0;
+               int intPrevLine;
+               bool FirstLine = TRUE;
     
-       // Remember to round down the calculation.
+               // Remember to round down the calculation.
 
-       while (intSeek < SettingLineLen){
+               while (intSeek < SettingLineLen){
        
-               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;
+                               intPrevLine = intSeek;
+                               FirstLine = FALSE;
                
-               }
+                       }
        
-               intSeek++;
-               intLineSeek++;
+                       intSeek++;
+                       intLineSeek++;
        
-       }
+               }
        
-       SettingFinal.Append(SettingLine);
+               SettingFinal.Append(SettingLine);
        
-    }
+       }
     
-    return SettingFinal;
+       return SettingFinal;
 
 }
 
 bool vCard::MeetBaseSpecification(){
-    // Check and see if the vCard object meets the base specification
-    // of vCard 4.0.
+       
+       // Check and see if the vCard object meets the base specification
+       // of vCard 4.0.
     
-    if (vCardBegin == TRUE && vCardEnd == TRUE && vCardFN == TRUE &&
-       vCardVersion == 4.0){
-       return TRUE;
-    } else {
-       return FALSE;
-    }
+       if (vCardBegin == TRUE && vCardEnd == TRUE && vCardFN == TRUE &&
+               vCardVersion == 4.0){
+
+               return TRUE;
+
+       } else {
+
+               return FALSE;
+
+       }
     
 }
 
 wxString vCard::Convert(wxString SettingValue, bool ReplaceMode){  
     
-    // Check for backslashes used for commas, newlines and
-    // backslashes used for values.
+       // Check for backslashes used for commas, newlines and
+       // backslashes used for values.
     
-    if (ReplaceMode == TRUE){
+       if (ReplaceMode == TRUE){
     
-       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("\\"));
     
-    } else {
+       } else {
 
-       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");
     
-    }
+       }
     
-    return SettingValue;
+       return SettingValue;
     
 }
 
 wxString vCard::GetFilename(){
 
-    return vCardFilename;
+       return vCardFilename;
 
 }
 
 std::map<int,wxString>* vCard::GetAllCards(){
 
-    return &Cards;
+       return &Cards;
 
 }
\ No newline at end of file
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