in SharpGen.Platform/CppParser.cs [971:1042]
private bool IsTypeBinded(XElement type)
=> IsTypeFromIncludeToProcess(type) || _boundTypes.Contains(type.AttributeValue("name"));
/// <summary>
/// Resolves a type to its fundamental type or a binded type.
/// This methods is going through the type declaration in order to return the most fundamental type
/// or to return a bind.
/// </summary>
/// <param name="typeId">The id of the type to resolve.</param>
/// <param name="type">The C++ type to fill.</param>
private void ResolveAndFillType(string typeId, CppMarshallable type)
{
var xType = _mapIdToXElement[typeId];
var isTypeResolved = false;
while (!isTypeResolved)
{
var name = xType.AttributeValue("name");
var nextType = xType.AttributeValue("type");
switch (xType.Name.LocalName)
{
case CastXml.TagFundamentalType:
type.TypeName = ConvertFundamentalType(name);
isTypeResolved = true;
break;
case CastXml.TagClass:
case CastXml.TagEnumeration:
case CastXml.TagStruct:
case CastXml.TagUnion:
type.TypeName = name;
isTypeResolved = true;
break;
case CastXml.TagTypedef:
if (_boundTypes.Contains(name))
{
type.TypeName = name;
isTypeResolved = true;
}
xType = _mapIdToXElement[nextType];
break;
case CastXml.TagPointerType:
xType = _mapIdToXElement[nextType];
type.Pointer += "*";
break;
case CastXml.TagArrayType:
var maxArrayIndex = xType.AttributeValue("max");
var arrayDim = int.Parse(maxArrayIndex.TrimEnd('u')) + 1;
if (type.ArrayDimension == null)
type.ArrayDimension = arrayDim.ToString();
else
type.ArrayDimension += "," + arrayDim;
xType = _mapIdToXElement[nextType];
break;
case CastXml.TagReferenceType:
xType = _mapIdToXElement[nextType];
type.Pointer += "&";
break;
case CastXml.TagCvQualifiedType:
xType = _mapIdToXElement[nextType];
type.Const = true;
break;
case CastXml.TagFunctionType:
// TODO, handle different calling convention
type.TypeName = "__function__stdcall";
isTypeResolved = true;
break;
default:
throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "Unexpected tag type [{0}]", xType.Name.LocalName));
}
}
}