Esempio n. 1
0
        public StructureMemberModel(string name, TypeModel type)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Value may not be null or empty.", "key");
            if (type == null)
                throw new ArgumentNullException("type");

            Name = name;
            Type = type;
        }
Esempio n. 2
0
        public ParameterModel(string name, TypeModel type, int indirectionLevel, ParameterModelFlags flags, string length)
        {
            if (string.IsNullOrEmpty(name))
                throw new ArgumentException("Value may not be null or empty.", "name");
            if (type == null)
                throw new ArgumentNullException("type");

            Name = name;
            Type = type;
            Flags = flags;
            IndirectionLevel = indirectionLevel;
            SizeParameter = length;
        }
Esempio n. 3
0
        public Type ResolveType(TypeModel model)
        {
            if (model == null)
                return null;
            if (model is EnumerationModel)
                return typeof(int);

            var translation = model as TranslationModel;
            if (translation != null)
            {
                var type = Type.GetType(translation.TargetType);
                if (type.IsValueType && Marshal.SizeOf(type) <= sizeof(long))
                    return type;
            }

            return typeof(IntPtr);
        }
Esempio n. 4
0
        public MarshalBehavior ResolveBehavior(TypeModel model)
        {
            var translation = model as TranslationModel;
            if (translation != null)
            {
                var type = Type.GetType(translation.TargetType);
                if (type == typeof(string))
                    return MarshalBehavior.String;
            }

            if (model is EnumerationModel)
                return MarshalBehavior.Enumeration;
            if (model is StructureModel)
                return MarshalBehavior.Structure;
            if (model is InterfaceModel || model.Key == "IUnknown")
                return MarshalBehavior.Interface;
            return MarshalBehavior.Direct;
        }
Esempio n. 5
0
 public FunctionModel(ApiModel api, string name, TypeModel returnType)
 {
     Api = api;
     Name = name;
     Type = returnType;
 }
Esempio n. 6
0
 public VariableModel(string name, TypeModel type)
 {
     Name = name;
     Type = type;
 }