Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Initial import of code already done for Xestia Address Book
[xestiaab/.git] / source / vcard / vcard.cpp~
1 #include "vcard.h" 
3 // vcard.cpp - Deals with vCard 4.0 formatted files meeting the
4 // RFC 6350 specification.
6 vCard::vCard(){
7     vCardBegin = FALSE;
8     vCardEnd = FALSE;
9     vCardFN = FALSE;
10     vCardVersion = 0.0;
11     SettingCount = 0;
12 }
14 void vCard::Add(wxString SettingName, wxString SettingValue){  
15     
16     // Check for backslashes used for commas, newlines and
17     // backslashes used for values.
18     
19     SettingValue.Replace(wxT("\\n"), wxT("\n"));
20     SettingValue.Replace(wxT("\\,"), wxT(","));
21     SettingValue.Replace(wxT("\\\\"), wxT("\\"));    
22   
23     // Check data to make sure that it meets the required
24     // vCard 4.0 specifications.
25     
26     //wxPuts(wxString::Format("%x", SettingValue));
27     
28     if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){
29         vCardBegin = TRUE;
30     }
31     
32     if (SettingName == wxT("END") && SettingValue == wxT("VCARD")){      
33         vCardEnd = TRUE;
34     }
35     
36     if (SettingName == wxT("FN")){
37         vCardFN = TRUE;
38     }
39     
40     if (SettingName == wxT("VERSION") && SettingValue == wxT("4.0")){
41         vCardVersion = 4.0;
42     }
43     
44     SettingNames.Add(SettingName, 1);
45     SettingValues.Add(SettingValue, 1);      
46     
47     ++SettingCount;
48 }
50 wxString vCard::Get(wxString SettingName){
51   
52     wxString SettingValue;
53   
54     wxPuts(wxT("IN THAR"));
55     
56     // Look for the setting name.
57     
58     for (int i = 0; i < SettingCount; i++){
59         wxPuts(wxT("Looking"));
60       
61         if (SettingNames[i] == SettingName){
62             SettingValue = SettingValues[i];
63             wxPuts(wxT("Here we are"));
64             wxPuts(SettingValue);
65             SettingValue.Trim(TRUE);
66             wxPuts(SettingValue);
67             return SettingValue;
68         }
69     }
70   
71 }
73 wxString vCard::GetById(int id){
74   
75 }
77 bool vCard::MeetBaseSpecification(){
78     // Check and see if the vCard object meets the base specification
79     // of vCard 4.0.
80     
81     if (vCardBegin == TRUE && vCardEnd == TRUE && vCardFN == TRUE &&
82         vCardVersion == 4.0){
83         return TRUE;
84     } else {
85         return FALSE;
86     }
87     
88 }
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