7#include <propvarutil.h>
30 ::VariantClear(&
var_);
40 var_.bstrVal = ::SysAllocStringLen(str,
length);
55 var_.boolVal =
value ? VARIANT_TRUE : VARIANT_FALSE;
86 ::VariantClear(&
var_);
110 ::VariantCopy(&ret, &
var_);
116 <<
"Comparison is not supported when |this| owns a SAFEARRAY";
118 <<
"Comparison is not supported when |other| owns a SAFEARRAY";
120 const bool this_is_empty =
var_.vt == VT_EMPTY ||
var_.vt == VT_NULL;
121 const bool other_is_empty = other.vt == VT_EMPTY || other.vt == VT_NULL;
125 return other_is_empty ? 0 : -1;
133 const bool this_is_unknown =
var_.vt == VT_UNKNOWN ||
var_.vt == VT_DISPATCH;
134 const bool other_is_unknown =
135 other.vt == VT_UNKNOWN || other.vt == VT_DISPATCH;
136 if (this_is_unknown && other_is_unknown) {
140 Microsoft::WRL::ComPtr<IUnknown> this_unknown;
141 Microsoft::WRL::ComPtr<IUnknown> other_unknown;
142 V_UNKNOWN(&
var_)->QueryInterface(IID_PPV_ARGS(&this_unknown));
143 V_UNKNOWN(&other)->QueryInterface(IID_PPV_ARGS(&other_unknown));
144 if (this_unknown.Get() == other_unknown.Get())
148 return std::less<>{}(this_unknown.Get(), other_unknown.Get()) ? -1 : 1;
152 if (V_VT(&
var_) != V_VT(&other))
153 return (V_VT(&
var_) < V_VT(&other)) ? -1 : 1;
155 const VARTYPE shared_vartype = V_VT(&
var_);
158 if (shared_vartype == VT_BSTR) {
159 ULONG flags = ignore_case ? NORM_IGNORECASE : 0;
161 ::VarBstrCmp(V_BSTR(&
var_), V_BSTR(&other), LOCALE_USER_DEFAULT,
flags);
163 <<
"unsupported variant comparison: " <<
var_.vt <<
" and " << other.vt;
178 return ::VariantCompare(
var_, other);
184 var_.bstrVal = ::SysAllocString(str);
255 var_.vt = VT_DISPATCH;
256 var_.pdispVal = disp;
264 var_.boolVal =
b ? VARIANT_TRUE : VARIANT_FALSE;
269 var_.vt = VT_UNKNOWN;
281 BASE_DCHECK(!array) <<
"Unable to determine safearray vartype";
289 BASE_DLOG() <<
"Error: VariantCopy failed";
295 if (var.ptr() != &
var_)
296 Reset(var.Release());
309 bool leakable =
false;
310 switch (vt & VT_TYPEMASK) {
332 case VT_STREAMED_OBJECT:
333 case VT_STORED_OBJECT:
335 case VT_VERSIONED_STREAM:
341 if (!leakable && (vt & VT_ARRAY) != 0) {
static const VARIANT kEmptyVariant
ScopedVariant & operator=(ScopedVariant &&var)
static bool IsLeakableVarType(VARTYPE vt)
void Set(const wchar_t *str)
void Reset(const VARIANT &var=kEmptyVariant)
int Compare(const VARIANT &other, bool ignore_case=false) const
void Swap(ScopedVariant &var)
FlutterSemanticsFlag flags
#define BASE_DCHECK(condition)