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
This commit is contained in:
@@ -134,7 +134,6 @@
|
|||||||
#define TEST_TEXTSTREAM
|
#define TEST_TEXTSTREAM
|
||||||
#define TEST_THREADS
|
#define TEST_THREADS
|
||||||
#define TEST_TIMER
|
#define TEST_TIMER
|
||||||
// #define TEST_VCARD -- don't enable this (VZ)
|
|
||||||
// #define TEST_VOLUME --FIXME! (RN)
|
// #define TEST_VOLUME --FIXME! (RN)
|
||||||
#define TEST_WCHAR
|
#define TEST_WCHAR
|
||||||
#define TEST_ZIP
|
#define TEST_ZIP
|
||||||
@@ -2939,248 +2938,6 @@ void TestTimer()
|
|||||||
|
|
||||||
#endif // TEST_TIMER
|
#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("<node>");
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
value = _T("<unknown value type>");
|
|
||||||
}
|
|
||||||
|
|
||||||
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("<none>");
|
|
||||||
}
|
|
||||||
|
|
||||||
wxPrintf(_T("Full name retrieved directly: %s\n"), value.c_str());
|
|
||||||
|
|
||||||
|
|
||||||
if ( !vcard.GetFullName(&value) )
|
|
||||||
{
|
|
||||||
value = _T("<none>");
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
// wxVolume tests
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -4453,11 +4210,6 @@ int main(int argc, char **argv)
|
|||||||
wxUsleep(3000);
|
wxUsleep(3000);
|
||||||
#endif // TEST_USLEEP
|
#endif // TEST_USLEEP
|
||||||
|
|
||||||
#ifdef TEST_VCARD
|
|
||||||
TestVCardRead();
|
|
||||||
TestVCardWrite();
|
|
||||||
#endif // TEST_VCARD
|
|
||||||
|
|
||||||
#ifdef TEST_VOLUME
|
#ifdef TEST_VOLUME
|
||||||
TestFSVolume();
|
TestFSVolume();
|
||||||
#endif // TEST_VOLUME
|
#endif // TEST_VOLUME
|
||||||
|
Reference in New Issue
Block a user