// ContactDataObject.cpp - Client Data Object. // // (c) 2012-2015 Xestia Software Development. // // This file is part of Xestia Address Book. // // Xestia Address Book is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by the // Free Software Foundation, version 3 of the license. // // Xestia Address Book is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with Xestia Address Book. If not, see #include "ContactDataObject.h" ContactLoadStatus ContactDataObject::LoadFile(wxString Filename){ if (!wxFileExists(Filename)){ return CONTACTLOAD_FILEMISSING; } wxFile ContactFile; if (!ContactFile.Open(Filename, wxFile::read, wxS_DEFAULT)){ return CONTACTLOAD_FILEERROR; } // Check that the vCard is a valid vCard 4.0 file. vCard vCard4FormatCheck; vCard4FormatCheck.LoadFile(Filename); if (vCard4FormatCheck.Get("VERSION") != wxT("4.0")){ return CONTACTLOAD_FILEINVALIDFORMAT; } // Check that the vCard meets the base specification. if (!vCard4FormatCheck.MeetBaseSpecification()){ return CONTACTLOAD_FILEBASESPECFAIL; } return CONTACTLOAD_UNITTESTFAIL; }