本文整理汇总了C++中wxVariant::ClearList方法的典型用法代码示例。如果您正苦于以下问题:C++ wxVariant::ClearList方法的具体用法?C++ wxVariant::ClearList怎么用?C++ wxVariant::ClearList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxVariant
的用法示例。
在下文中一共展示了wxVariant::ClearList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
WXDLLEXPORT bool
wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant)
{
bool ok = true;
if ( oleVariant.vt & VT_ARRAY )
{
// Compute the total number of elements in all array dimensions
int cElements = 1;
for ( int cDims = 0; cDims < oleVariant.parray->cDims; cDims++ )
cElements *= oleVariant.parray->rgsabound[cDims].cElements;
// Get a pointer to the data
void* pvdata;
HRESULT hr = SafeArrayAccessData(oleVariant.parray, &pvdata);
if ( FAILED(hr) )
return false;
switch (oleVariant.vt & VT_TYPEMASK)
{
case VT_VARIANT:
{
variant.ClearList();
VARIANTARG *variant_data=(VARIANTARG*)pvdata;
for ( int i = 0; i < cElements; i++ )
{
VARIANTARG& oleElement = variant_data[i];
wxVariant vElement;
if ( !wxConvertOleToVariant(oleElement, vElement) )
{
ok = false;
variant.ClearList();
break;
}
variant.Append(vElement);
}
}
break;
case VT_BSTR:
{
wxArrayString strings;
BSTR *string_val=(BSTR*)pvdata;
for ( int i = 0; i < cElements; ++i )
{
wxString str=wxConvertStringFromOle(*string_val);
strings.Add(str);
++string_val;
}
variant=strings;
}
break;
default:
wxLogDebug(wxT("unhandled VT_ARRAY type %x in wxConvertOleToVariant"),
oleVariant.vt & VT_TYPEMASK);
variant = wxVariant();
ok = false;
break;
}
SafeArrayUnaccessData(oleVariant.parray);
}
else if ( oleVariant.vt & VT_BYREF )
{
switch ( oleVariant.vt & VT_TYPEMASK )
{
case VT_VARIANT:
{
VARIANTARG& oleReference = *((LPVARIANT)oleVariant.byref);
if (!wxConvertOleToVariant(oleReference,variant))
return false;
break;
}
default:
wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: [as yet] unhandled reference %X"),
oleVariant.vt);
return false;
}
}
else // simply type (not array or reference)
{
switch ( oleVariant.vt & VT_TYPEMASK )
{
case VT_BSTR:
{
wxString str(wxConvertStringFromOle(oleVariant.bstrVal));
variant = str;
}
break;
case VT_DATE:
#if wxUSE_DATETIME
{
SYSTEMTIME st;
VariantTimeToSystemTime(oleVariant.date, &st);
wxDateTime date;
//.........这里部分代码省略.........