CPropVariant& CPropVariant::operator=(const UString2 &s)
{ /* if (s.IsEmpty()) *this = L""; else
*/
{
InternalClear();
vt = VT_BSTR;
wReserved1 = 0;
bstrVal = ::SysAllocStringLen(s.GetRawPtr(), s.Len()); if (!bstrVal) throw kMemException; /* SysAllocStringLen probably appends a null-terminating character for NULL string. But it doesn't specified in MSDN. But we suppose that it works
if (!s.GetRawPtr()) { *bstrVal = 0; }
*/
/* MSDN: Windows CE: SysAllocStringLen() : Passing invalid (and under some circumstances NULL) pointers to this function causes an unexpected termination of the application.
Is it safe? Maybe we must chamnge the code for that case ? */
} return *this;
}
HRESULT PropVariant_Clear(PROPVARIANT *prop) throw()
{ switch (prop->vt)
{ case VT_EMPTY: case VT_UI1: case VT_I1: case VT_I2: case VT_UI2: case VT_BOOL: case VT_I4: case VT_UI4: case VT_R4: case VT_INT: case VT_UINT: case VT_ERROR: case VT_FILETIME: case VT_UI8: case VT_R8: case VT_CY: case VT_DATE:
prop->vt = VT_EMPTY;
prop->wReserved1 = 0;
prop->wReserved2 = 0;
prop->wReserved3 = 0;
prop->uhVal.QuadPart = 0; return S_OK;
} return ::VariantClear((VARIANTARG *)prop); // return ::PropVariantClear(prop); // PropVariantClear can clear VT_BLOB.
}
HRESULT CPropVariant::Clear() throw()
{ if (vt == VT_EMPTY) return S_OK; return PropVariant_Clear(this);
}
HRESULT CPropVariant::Copy(const PROPVARIANT* pSrc) throw()
{
::VariantClear((tagVARIANT *)this); switch (pSrc->vt)
{ case VT_UI1: case VT_I1: case VT_I2: case VT_UI2: case VT_BOOL: case VT_I4: case VT_UI4: case VT_R4: case VT_INT: case VT_UINT: case VT_ERROR: case VT_FILETIME: case VT_UI8: case VT_R8: case VT_CY: case VT_DATE:
memmove((PROPVARIANT*)this, pSrc, sizeof(PROPVARIANT)); return S_OK;
} return ::VariantCopy((tagVARIANT *)this, (tagVARIANT *)const_cast<PROPVARIANT *>(pSrc));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.