public string GetSystemTypeName(bool addComment = false) { if (type.Pointee is CppSharp.AST.FunctionType) { return(TypeWrapperFactory.CreateTypeWrapper(type.Pointee).GetSystemTypeName()); } else if (type.Pointee is CppSharp.AST.BuiltinType) { CppSharp.AST.BuiltinType buildin = type.Pointee as CppSharp.AST.BuiltinType; if (buildin.Type == CppSharp.AST.PrimitiveType.UInt8 || buildin.Type == CppSharp.AST.PrimitiveType.Int8 || buildin.Type == CppSharp.AST.PrimitiveType.Char || buildin.Type == CppSharp.AST.PrimitiveType.UChar) { return("string"); } } string pointeeTypeName = TypeWrapperFactory.CreateTypeWrapper(type.Pointee).GetSystemTypeName(); string ret = "IntPtr"; if (addComment) { ret += "/* " + pointeeTypeName + "* */"; } return(ret); }
public string GetRawTypeName() { string functionTag = ""; functionTag += TypeWrapperFactory.CreateTypeWrapper(type.ReturnType.Type).GetSystemTypeName(); functionTag += "("; for (int i = 0; i < type.Parameters.Count; i++) { var param = type.Parameters[i]; functionTag += TypeWrapperFactory.CreateTypeWrapper(param.Type).GetSystemTypeName(); if (i != (type.Parameters.Count - 1)) { functionTag += ","; } } functionTag += ")"; return(functionTag); }
public string GetMarshalTag() { if (type.Pointee is CppSharp.AST.FunctionType) { return(TypeWrapperFactory.CreateTypeWrapper(type.Pointee).GetMarshalTag()); } else if (type.Pointee is CppSharp.AST.BuiltinType) { CppSharp.AST.BuiltinType buildin = type.Pointee as CppSharp.AST.BuiltinType; if (buildin.Type == CppSharp.AST.PrimitiveType.UInt8 || buildin.Type == CppSharp.AST.PrimitiveType.Int8 || buildin.Type == CppSharp.AST.PrimitiveType.Char || buildin.Type == CppSharp.AST.PrimitiveType.UChar) { return("[MarshalAs(UnmanagedType.LPStr)]"); } } return(""); }
public string GetSystemTypeName(bool addComment = false) { string tag = GetRawTypeName(); if (TypeWrapperFactory.DelegateGenerator.ContainsKey(tag)) { return(TypeWrapperFactory.DelegateGenerator[tag].name); } else { DelegateDefine deleg = new DelegateDefine(); deleg.tag = tag; deleg.name = TypeWrapperFactory.CurrentPrefix + "_func_" + TypeWrapperFactory.DelegateGenerator.Count.ToString(); //public delegate int GetBufferCallback(IntPtr pAVCodecContext, IntPtr pAVFrame); deleg.fullName = "public delegate "; deleg.fullName += TypeWrapperFactory.CreateTypeWrapper(type.ReturnType.Type).GetSystemTypeName(true); deleg.fullName += " " + deleg.name + "(\r\n"; for (int i = 0; i < type.Parameters.Count; i++) { var param = type.Parameters[i]; deleg.fullName += "\t" + TypeWrapperFactory.CreateTypeWrapper(param.Type).GetMarshalTag(); deleg.fullName += TypeWrapperFactory.CreateTypeWrapper(param.Type).GetSystemTypeName(true); if (!string.IsNullOrEmpty(param.Name)) { deleg.fullName += " " + param.Name; } else { deleg.fullName += " __arg" + i.ToString(); } if (i != (type.Parameters.Count - 1)) { deleg.fullName += ", \r\n"; } } deleg.fullName += ");"; TypeWrapperFactory.DelegateGenerator.Add(tag, deleg); return(deleg.name); } }
public static string GetMarshalTag(CppSharp.AST.Type type) { return(TypeWrapperFactory.CreateTypeWrapper(type).GetMarshalTag()); }
public static string GetSystemTypeName(CppSharp.AST.Type type, bool addComment = false) { return(TypeWrapperFactory.CreateTypeWrapper(type).GetSystemTypeName(addComment)); }
public static string GetRawTypeName(CppSharp.AST.Type type) { return(TypeWrapperFactory.CreateTypeWrapper(type).GetRawTypeName()); }
public string GetRawTypeName() { string typeName = TypeWrapperFactory.CreateTypeWrapper(type.Type).GetRawTypeName(); return(typeName); }
public string GetMarshalTag() { return(TypeWrapperFactory.CreateTypeWrapper(type.Declaration.Type).GetMarshalTag()); }
public string GetSystemTypeName(bool addComment = false) { return(TypeWrapperFactory.CreateTypeWrapper(type.Declaration.Type).GetSystemTypeName()); }
public string GetRawTypeName() { return(TypeWrapperFactory.CreateTypeWrapper(type.Declaration.Type).GetRawTypeName()); }