#include "vcard.h" // vcard.cpp - Deals with vCard 4.0 formatted files meeting the // RFC 6350 specification. vCard::vCard(){ vCardBegin = FALSE; vCardEnd = FALSE; vCardFN = FALSE; vCardVersion = 0.0; SettingCount = 0; } void vCard::Add(wxString SettingName, wxString SettingValue){ // 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("\\")); // Check data to make sure that it meets the required // vCard 4.0 specifications. //wxPuts(wxString::Format("%x", SettingValue)); if (SettingName == wxT("BEGIN") && SettingValue == wxT("VCARD")){ vCardBegin = TRUE; } if (SettingName == wxT("END") && SettingValue == wxT("VCARD")){ vCardEnd = TRUE; } if (SettingName == wxT("FN")){ vCardFN = TRUE; } if (SettingName == wxT("VERSION") && SettingValue == wxT("4.0")){ vCardVersion = 4.0; } SettingNames.Add(SettingName, 1); SettingValues.Add(SettingValue, 1); ++SettingCount; } wxString vCard::Get(wxString SettingName){ wxString SettingValue; wxPuts(wxT("IN THAR")); // Look for the setting name. for (int i = 0; i < SettingCount; i++){ wxPuts(wxT("Looking")); if (SettingNames[i] == SettingName){ SettingValue = SettingValues[i]; wxPuts(wxT("Here we are")); wxPuts(SettingValue); SettingValue.Trim(TRUE); wxPuts(SettingValue); return SettingValue; } } } wxString vCard::GetById(int id){ } bool vCard::MeetBaseSpecification(){ // 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; } }