本文整理汇总了C++中wxVariant::MakeNull方法的典型用法代码示例。如果您正苦于以下问题:C++ wxVariant::MakeNull方法的具体用法?C++ wxVariant::MakeNull怎么用?C++ wxVariant::MakeNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxVariant
的用法示例。
在下文中一共展示了wxVariant::MakeNull方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetValue
void vvStampsModel::GetValue(
wxVariant& cValue,
const wxDataViewItem& cItem,
unsigned int uColumn
) const
{
wxASSERT(cItem.IsOk());
const DataItem* pItem = this->ConvertDataItem(cItem);
switch (static_cast<Column>(uColumn))
{
case COLUMN_B_CHECKED:
cValue = pItem->bChecked;
return;
case COLUMN_BS_NAME:
case COLUMN_S_NAME:
cValue = pItem->sName;
return;
case COLUMN_U_COUNT:
cValue = static_cast<long>(pItem->uCount);
return;
default:
wxLogError("Unknown StampsModel column: %u", uColumn);
cValue.MakeNull();
return;
}
}
示例2: s
void PgStatement::GetFieldValue
(
int nIndex,
wxVariant& v
)
{
int nIsNull = PQgetisnull(pgr, nCurrentRecord, nIndex);
if(nIsNull != 0)
{
v.MakeNull();
return;
}
char * sz = PQgetvalue(pgr, nCurrentRecord, nIndex);
Oid typ = PQftype(pgr, nIndex);
switch(typ)
{
case PG_OID_BOOLEAN:
{
bool b = (sz[0] == 't')? true : false;
v = b;
break;
}
case PG_OID_OID:
case PG_OID_INT4:
case PG_OID_TRANSACTIONID:
{
long n = atol(sz);
v = n;
break;
}
case PG_OID_DOUBLE:
{
double d = atof(sz);
v = d;
break;
}
case PG_OID_NAME:
case PG_OID_TEXT:
case PG_OID_VARCHAR_LENGTH:
{
//int nFormat = PQfformat(pgr, nIndex); // 0 => text, 1 => binary
wxString s(sz, wxConvLocal);
//wxString s = wxConvUTF8.cMB2WX(sz);
v = s;
break;
}
// Items we don't know how to handle
case PG_OID_TEXTARRAY:
case PG_OID_ACLITEMARRAY:
v = wxT("");
break;
default:
throw wx::Exception(wxT("PgStatement::GetFieldValue() Unhandled data type %d"), typ);
}
}
示例3: MSWVariantToVariant
bool MSWVariantToVariant(VARIANTARG& va, wxVariant& vx)
{
switch(va.vt)
{
case VT_VARIANT | VT_BYREF:
return MSWVariantToVariant(*va.pvarVal, vx);
case VT_I2:
case VT_I4:
vx = (long) va.iVal;
return true;
case VT_I2 | VT_BYREF:
case VT_I4 | VT_BYREF:
vx = (long) *va.piVal;
return true;
case VT_BSTR:
vx = wxString(va.bstrVal);
return true;
case VT_BSTR | VT_BYREF:
vx = wxString(*va.pbstrVal);
return true;
case VT_BOOL:
vx = (va.boolVal != FALSE);
return true;
case VT_BOOL | VT_BYREF:
vx = (*va.pboolVal != FALSE);
return true;
default:
vx.MakeNull();
return false;
};
};
示例4: if
//.........这里部分代码省略.........
wxLogDebug(wxT("unhandled VT_ARRAY type %x in wxConvertOleToVariant"),
oleVariant.vt & VT_TYPEMASK);
variant = wxVariant();
}
}
}
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_ERROR:
variant.SetData(new wxVariantDataErrorCode(oleVariant.scode));
break;
case VT_CY:
variant.SetData(new wxVariantDataCurrency(oleVariant.cyVal));
break;
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;
date.SetFromMSWSysTime(st);
variant = date;
}
#endif // wxUSE_DATETIME
break;
#if wxUSE_LONGLONG
case VT_I8:
variant = wxLongLong(oleVariant.llVal);
break;
#endif // wxUSE_LONGLONG
case VT_I4:
variant = (long) oleVariant.lVal;
break;
case VT_I2:
variant = (long) oleVariant.iVal;
break;
case VT_BOOL:
variant = oleVariant.boolVal != 0;
break;
case VT_R4:
variant = oleVariant.fltVal;
break;
case VT_R8:
variant = oleVariant.dblVal;
break;
case VT_DISPATCH:
variant = (void*) oleVariant.pdispVal;
break;
case VT_NULL:
case VT_EMPTY:
variant.MakeNull();
break;
default:
wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: Unknown variant value type %X -> %X"),
oleVariant.vt,oleVariant.vt&VT_TYPEMASK);
return false;
}
}
return ok;
}
示例5: if
//.........这里部分代码省略.........
variant = wxVariant();
}
}
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_ERROR:
variant.SetData(new wxVariantDataErrorCode(oleVariant.scode));
break;
case VT_CY:
variant.SetData(new wxVariantDataCurrency(oleVariant.cyVal));
break;
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;
date.SetFromMSWSysTime(st);
variant = date;
}
#endif // wxUSE_DATETIME
break;
// See the comment before the __VISUALC6__ test above.
#if wxUSE_LONGLONG && !defined(__VISUALC6__)
case VT_I8:
variant = wxLongLong(oleVariant.llVal);
break;
#endif // wxUSE_LONGLONG
case VT_I4:
variant = (long) oleVariant.lVal;
break;
case VT_I2:
variant = (long) oleVariant.iVal;
break;
case VT_BOOL:
variant = oleVariant.boolVal != 0;
break;
case VT_R4:
variant = oleVariant.fltVal;
break;
case VT_R8:
variant = oleVariant.dblVal;
break;
case VT_DISPATCH:
variant = (void*) oleVariant.pdispVal;
break;
case VT_NULL:
variant.MakeNull();
break;
case VT_EMPTY:
break; // Ignore Empty Variant, used only during destruction of objects
default:
wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: Unknown variant value type %X -> %X"),
oleVariant.vt,oleVariant.vt&VT_TYPEMASK);
return false;
}
}
return ok;
}
示例6: if
//.........这里部分代码省略.........
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;
date.SetFromMSWSysTime(st);
variant = date;
}
#endif // wxUSE_DATETIME
break;
case VT_I4:
variant = (long) oleVariant.lVal;
break;
case VT_I2:
variant = (long) oleVariant.iVal;
break;
case VT_BOOL:
variant = oleVariant.boolVal != 0;
break;
case VT_R8:
variant = oleVariant.dblVal;
break;
case VT_DISPATCH:
variant = (void*) oleVariant.pdispVal;
break;
case VT_NULL:
variant.MakeNull();
break;
case VT_EMPTY:
break; // Ignore Empty Variant, used only during destruction of objects
default:
wxLogError(wxT("wxAutomationObject::ConvertOleToVariant: Unknown variant value type %X -> %X"),
oleVariant.vt,oleVariant.vt&VT_TYPEMASK);
return false;
}
}
return ok;
}