in cppwinrt/helpers.h [662:738]
inline param_category get_category(TypeSig const& signature, TypeDef* signature_type = nullptr)
{
if (signature.is_szarray())
{
return param_category::array_type;
}
param_category result{};
call(signature.Type(),
[&](ElementType type)
{
if (type == ElementType::String)
{
result = param_category::string_type;
}
else if (type == ElementType::Object)
{
result = param_category::object_type;
}
else
{
result = param_category::fundamental_type;
}
},
[&](coded_index<TypeDefOrRef> const& type)
{
TypeDef type_def;
if (type.type() == TypeDefOrRef::TypeDef)
{
type_def = type.TypeDef();
}
else
{
auto type_ref = type.TypeRef();
if (type_name(type_ref) == "System.Guid")
{
result = param_category::struct_type;
return;
}
type_def = find_required(type_ref);
}
if (signature_type)
{
*signature_type = type_def;
}
switch (get_category(type_def))
{
case category::interface_type:
case category::class_type:
case category::delegate_type:
result = param_category::object_type;
return;
case category::struct_type:
result = param_category::struct_type;
return;
case category::enum_type:
result = param_category::enum_type;
return;
}
},
[&](GenericTypeInstSig const&)
{
result = param_category::object_type;
},
[&](auto&&)
{
result = param_category::generic_type;
});
return result;
}