From 30e60550013cd409a06c3a0287d10feba487187e Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Mon, 23 Mar 2009 16:28:22 +0000 Subject: [PATCH] remove VCard code leftover: it's not part of wx git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/console/console.cpp | 248 ------------------------------------ 1 file changed, 248 deletions(-) diff --git a/samples/console/console.cpp b/samples/console/console.cpp index f27d836a45..b996573935 100644 --- a/samples/console/console.cpp +++ b/samples/console/console.cpp @@ -134,7 +134,6 @@ #define TEST_TEXTSTREAM #define TEST_THREADS #define TEST_TIMER - // #define TEST_VCARD -- don't enable this (VZ) // #define TEST_VOLUME --FIXME! (RN) #define TEST_WCHAR #define TEST_ZIP @@ -2939,248 +2938,6 @@ void TestTimer() #endif // TEST_TIMER -// ---------------------------------------------------------------------------- -// vCard support -// ---------------------------------------------------------------------------- - -#ifdef TEST_VCARD - -#include "wx/vcard.h" - -static void DumpVObject(size_t level, const wxVCardObject& vcard) -{ - void *cookie; - wxVCardObject *vcObj = vcard.GetFirstProp(&cookie); - while ( vcObj ) - { - wxPrintf(_T("%s%s"), - wxString(_T('\t'), level).c_str(), - vcObj->GetName().c_str()); - - wxString value; - switch ( vcObj->GetType() ) - { - case wxVCardObject::String: - case wxVCardObject::UString: - { - wxString val; - vcObj->GetValue(&val); - value << _T('"') << val << _T('"'); - } - break; - - case wxVCardObject::Int: - { - unsigned int i; - vcObj->GetValue(&i); - value.Printf(_T("%u"), i); - } - break; - - case wxVCardObject::Long: - { - unsigned long l; - vcObj->GetValue(&l); - value.Printf(_T("%lu"), l); - } - break; - - case wxVCardObject::None: - break; - - case wxVCardObject::Object: - value = _T(""); - break; - - default: - value = _T(""); - } - - if ( !!value ) - wxPrintf(_T(" = %s"), value.c_str()); - wxPutchar('\n'); - - DumpVObject(level + 1, *vcObj); - - delete vcObj; - vcObj = vcard.GetNextProp(&cookie); - } -} - -static void DumpVCardAddresses(const wxVCard& vcard) -{ - wxPuts(_T("\nShowing all addresses from vCard:\n")); - - size_t nAdr = 0; - void *cookie; - wxVCardAddress *addr = vcard.GetFirstAddress(&cookie); - while ( addr ) - { - wxString flagsStr; - int flags = addr->GetFlags(); - if ( flags & wxVCardAddress::Domestic ) - { - flagsStr << _T("domestic "); - } - if ( flags & wxVCardAddress::Intl ) - { - flagsStr << _T("international "); - } - if ( flags & wxVCardAddress::Postal ) - { - flagsStr << _T("postal "); - } - if ( flags & wxVCardAddress::Parcel ) - { - flagsStr << _T("parcel "); - } - if ( flags & wxVCardAddress::Home ) - { - flagsStr << _T("home "); - } - if ( flags & wxVCardAddress::Work ) - { - flagsStr << _T("work "); - } - - wxPrintf(_T("Address %u:\n") - "\tflags = %s\n" - "\tvalue = %s;%s;%s;%s;%s;%s;%s\n", - ++nAdr, - flagsStr.c_str(), - addr->GetPostOffice().c_str(), - addr->GetExtAddress().c_str(), - addr->GetStreet().c_str(), - addr->GetLocality().c_str(), - addr->GetRegion().c_str(), - addr->GetPostalCode().c_str(), - addr->GetCountry().c_str() - ); - - delete addr; - addr = vcard.GetNextAddress(&cookie); - } -} - -static void DumpVCardPhoneNumbers(const wxVCard& vcard) -{ - wxPuts(_T("\nShowing all phone numbers from vCard:\n")); - - size_t nPhone = 0; - void *cookie; - wxVCardPhoneNumber *phone = vcard.GetFirstPhoneNumber(&cookie); - while ( phone ) - { - wxString flagsStr; - int flags = phone->GetFlags(); - if ( flags & wxVCardPhoneNumber::Voice ) - { - flagsStr << _T("voice "); - } - if ( flags & wxVCardPhoneNumber::Fax ) - { - flagsStr << _T("fax "); - } - if ( flags & wxVCardPhoneNumber::Cellular ) - { - flagsStr << _T("cellular "); - } - if ( flags & wxVCardPhoneNumber::Modem ) - { - flagsStr << _T("modem "); - } - if ( flags & wxVCardPhoneNumber::Home ) - { - flagsStr << _T("home "); - } - if ( flags & wxVCardPhoneNumber::Work ) - { - flagsStr << _T("work "); - } - - wxPrintf(_T("Phone number %u:\n") - "\tflags = %s\n" - "\tvalue = %s\n", - ++nPhone, - flagsStr.c_str(), - phone->GetNumber().c_str() - ); - - delete phone; - phone = vcard.GetNextPhoneNumber(&cookie); - } -} - -static void TestVCardRead() -{ - wxPuts(_T("*** Testing wxVCard reading ***\n")); - - wxVCard vcard(_T("vcard.vcf")); - if ( !vcard.IsOk() ) - { - wxPuts(_T("ERROR: couldn't load vCard.")); - } - else - { - // read individual vCard properties - wxVCardObject *vcObj = vcard.GetProperty("FN"); - wxString value; - if ( vcObj ) - { - vcObj->GetValue(&value); - delete vcObj; - } - else - { - value = _T(""); - } - - wxPrintf(_T("Full name retrieved directly: %s\n"), value.c_str()); - - - if ( !vcard.GetFullName(&value) ) - { - value = _T(""); - } - - wxPrintf(_T("Full name from wxVCard API: %s\n"), value.c_str()); - - // now show how to deal with multiply occurring properties - DumpVCardAddresses(vcard); - DumpVCardPhoneNumbers(vcard); - - // and finally show all - wxPuts(_T("\nNow dumping the entire vCard:\n") - "-----------------------------\n"); - - DumpVObject(0, vcard); - } -} - -static void TestVCardWrite() -{ - wxPuts(_T("*** Testing wxVCard writing ***\n")); - - wxVCard vcard; - if ( !vcard.IsOk() ) - { - wxPuts(_T("ERROR: couldn't create vCard.")); - } - else - { - // set some fields - vcard.SetName("Zeitlin", "Vadim"); - vcard.SetFullName("Vadim Zeitlin"); - vcard.SetOrganization("wxWidgets", "R&D"); - - // just dump the vCard back - wxPuts(_T("Entire vCard follows:\n")); - wxPuts(vcard.Write()); - } -} - -#endif // TEST_VCARD - // ---------------------------------------------------------------------------- // wxVolume tests // ---------------------------------------------------------------------------- @@ -4453,11 +4210,6 @@ int main(int argc, char **argv) wxUsleep(3000); #endif // TEST_USLEEP -#ifdef TEST_VCARD - TestVCardRead(); - TestVCardWrite(); -#endif // TEST_VCARD - #ifdef TEST_VOLUME TestFSVolume(); #endif // TEST_VOLUME -- 2.45.2