Пример #1
0
    XInterfaceTypeDescription2 resolveInterfaceTypedef(
        XTypeDescription type)
    {
        XInterfaceTypeDescription2 xIfaceTd = type as XInterfaceTypeDescription2;

        if (xIfaceTd != null)
            return xIfaceTd;

        XIndirectTypeDescription xIndTd = type as XIndirectTypeDescription;
        if (xIndTd == null)
            throw new System.Exception(
                "resolveInterfaceTypedef was called with an invalid argument");

        return resolveInterfaceTypedef(xIndTd.getReferencedType());
    }
Пример #2
0
 public Type get_type(XTypeDescription xType)
 {
     switch (xType.getTypeClass())
     {
     case TypeClass.VOID:
         return typeof(void);
     case TypeClass.CHAR:
         return typeof(System.Char);
     case TypeClass.BOOLEAN:
         return typeof(System.Boolean);
     case TypeClass.BYTE:
         return typeof(System.Byte);
     case TypeClass.SHORT:
         return typeof(System.Int16);
     case TypeClass.UNSIGNED_SHORT:
         return typeof(System.UInt16);
     case TypeClass.LONG:
         return typeof(System.Int32);
     case TypeClass.UNSIGNED_LONG:
         return typeof(System.UInt32);
     case TypeClass.HYPER:
         return typeof(System.Int64);
     case TypeClass.UNSIGNED_HYPER:
         return typeof(System.UInt64);
     case TypeClass.FLOAT:
         return typeof(System.Single);
     case TypeClass.DOUBLE:
         return typeof(System.Double);
     case TypeClass.STRING:
         return typeof(System.String);
     case TypeClass.TYPE:
         return typeof(System.Type);
     case TypeClass.ANY:
         return typeof(uno.Any);
     case TypeClass.ENUM:
         return get_type((XEnumTypeDescription) xType);
     case TypeClass.TYPEDEF:
         // unwind typedefs
         return get_type(((XIndirectTypeDescription)
                          xType).getReferencedType());
     case TypeClass.STRUCT:
     case TypeClass.EXCEPTION:
         return get_type((XCompoundTypeDescription) xType);
     case TypeClass.SEQUENCE:
     {
         Type element_type = get_type(((XIndirectTypeDescription)
                                       xType).getReferencedType());
         return get_type(element_type.FullName + "[]", true);
     }
     case TypeClass.INTERFACE:
         return get_type((XInterfaceTypeDescription2) xType);
     case TypeClass.CONSTANT:
         return get_type((XConstantTypeDescription) xType);
     case TypeClass.CONSTANTS:
         return get_type((XConstantsTypeDescription) xType);
     case TypeClass.SERVICE:
         return get_type((XServiceTypeDescription2) xType);
     case TypeClass.SINGLETON:
         return get_type((XSingletonTypeDescription2) xType);
     case TypeClass.MODULE:
         // ignore these
         return null;
     default:
         throw new System.Exception("unexpected type " + xType.getName());
     }
 }