public override string CSharpSignature(CSharpTypePrinterContext ctx) { var type = Type as TemplateSpecializationType; return(string.Format("System.Collections.Generic.Dictionary<{0}, {1}>", type.Arguments[0].Type, type.Arguments[1].Type)); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) return "Std.Vector"; return string.Format("Std.Vector<{0}>", ctx.GetTemplateParameterList()); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { TemplateArgument templateArgument = ((TemplateSpecializationType)ctx.Type.Desugar()).Arguments[0]; return(templateArgument.Type.Type.ToString()); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { return(string.Format("QtCore.QString.{0}{1}", Helpers.InternalStruct, ctx.Type.IsAddress() ? "*" : string.Empty)); } return("string"); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { return string.Format("QtCore.QString.{0}{1}", Helpers.InternalStruct, ctx.Type.IsAddress() ? "*" : string.Empty); } return "string"; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) return Type.IsAddress() ? "QList.Internal*" : "QList.Internal"; return string.Format("System.Collections.Generic.{0}<{1}>", ctx.MarshalKind == CSharpMarshalKind.DefaultExpression ? "List" : "IList", ctx.GetTemplateParameterList()); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Managed) return "string"; ClassTemplateSpecialization basicString = GetBasicString(ctx.Type); var typePrinter = new CSharpTypePrinter(null); typePrinter.PushContext(CSharpTypePrinterContextKind.Native); return basicString.Visit(typePrinter).Type; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Managed) return "string"; ClassTemplateSpecialization basicString = GetBasicString(ctx.Type); var typePrinter = new CSharpTypePrinter(null); typePrinter.PushContext(CSharpTypePrinterContextKind.Native); return basicString.Visit(typePrinter).Type; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) return "Std.Map"; var type = Type as TemplateSpecializationType; return string.Format("System.Collections.Generic.Dictionary<{0}, {1}>", type.Arguments[0].Type, type.Arguments[1].Type); }
private bool?CheckForDefaultConstruct(Type desugared, Parameter parameter) { Method ctor = parameter.DefaultArgument.Declaration as Method; if (ctor == null || !ctor.IsConstructor) { return(false); } Type type; desugared.IsPointerTo(out type); type = type ?? desugared; Class decl; if (!type.TryGetClass(out decl)) { return(false); } TypeMap typeMap; if (Driver.TypeDatabase.FindTypeMap(decl, type, out typeMap)) { string mappedTo; if (Driver.Options.IsCSharpGenerator) { var typePrinterContext = new CSharpTypePrinterContext { CSharpKind = CSharpTypePrinterContextKind.Managed, Type = type }; mappedTo = typeMap.CSharpSignature(typePrinterContext); } else { var typePrinterContext = new CLITypePrinterContext { Type = type }; mappedTo = typeMap.CLISignature(typePrinterContext); } if (mappedTo == "string" && ctor.Parameters.Count == 0) { parameter.DefaultArgument.String = "\"\""; return(true); } } parameter.DefaultArgument.String = string.Format("new {0}", parameter.DefaultArgument.String); if (ctor.Parameters.Count > 0 && ctor.Parameters[0].OriginalName == "_0") { parameter.DefaultArgument.String = parameter.DefaultArgument.String.Replace("(0)", "()"); } return(decl.IsValueType ? true : (bool?)null); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) return "Std.Map"; var type = Type as TemplateSpecializationType; return string.Format( "System.Collections.Generic.Dictionary<{0}, {1}>", type.Arguments[0].Type, type.Arguments[1].Type); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { return(Type.IsAddress() ? "QList.Internal*" : "QList.Internal"); } return(string.Format("System.Collections.Generic.{0}<{1}>", ctx.CSharpKind == CSharpTypePrinterContextKind.DefaultExpression ? "List" : "IList", ctx.GetTemplateParameterList())); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { return(string.Format("QList.{0}{1}", Helpers.InternalStruct, Type.IsAddress() ? "*" : string.Empty)); } return(string.Format("System.Collections.Generic.{0}<{1}>", ctx.MarshalKind == CSharpMarshalKind.DefaultExpression ? "List" : "IList", ctx.GetTemplateParameterList())); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { if (Type.IsAddress()) { return("QList.Internal*"); } return("QList.Internal"); } return("QList"); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { if (ctx.Type.IsAddress()) { return "QtCore.QString.Internal*"; } return "QtCore.QString.Internal"; } return "string"; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { // pointless, put just so that the generated code compiles return("global::System.IntPtr"); } return(string.Format("System.Collections.Generic.{0}<{1}>", ctx.CSharpKind == CSharpTypePrinterContextKind.DefaultExpression ? "List" : "IList", ctx.GetTemplateParameterList())); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { var type = Type as TemplateSpecializationType; var args = type.Arguments.Select(arg => arg.Type.ToString()). ToList(); var output = "System.Action"; if (args.Count > 0) output += string.Format("<{0}>", string.Join(", ", args)); return output; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { var type = Type as TemplateSpecializationType; var args = type.Arguments.Select(arg => arg.Type.ToString()). ToList(); var output = "System.Action"; if (args.Count > 0) { output += string.Format("<{0}>", string.Join(", ", args)); } return(output); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { var fullType = ctx.FullType.Type; var isPointer = (fullType != null) && (fullType is PointerType || fullType.Desugar() is TemplateSpecializationType); if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native && isPointer) { return("global::System.IntPtr"); } var type = Type as TemplateSpecializationType; return(string.Format("{0}", type.Arguments[0].Type)); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { if (ctx.FullType.Type is PointerType) { return("Flood.ResourceHandle*"); } // Handles only contain a single 32-bit unsigned int handle id. return("Flood.ResourceHandle"); } var type = Type.Desugar() as TemplateSpecializationType; return(string.Format("Flood.ResourceHandle<{0}>", type.Arguments[0].Type)); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { if (Type.IsAddress()) { return("QList.Internal*"); } return("QList.Internal"); } TemplateSpecializationType templateSpecialization = (TemplateSpecializationType)ctx.Type.Desugar(); TemplateArgument templateArgument = templateSpecialization.Arguments[0]; if (templateArgument.Type.Type.IsPointerToPrimitiveType()) { return("System.Collections.Generic.IList<global::System.IntPtr>"); } return(string.Format("System.Collections.Generic.IList<{0}>", ctx.GetTemplateParameterList())); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return(CSharpSignatureType(ctx).ToString()); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { if (ctx.FullType.Type is PointerType) return "Flood.ResourceHandle*"; // Handles only contain a single 32-bit unsigned int handle id. return "Flood.ResourceHandle"; } var type = Type.Desugar() as TemplateSpecializationType; return string.Format("Flood.ResourceHandle<{0}>", type.Arguments[0].Type); }
private bool? CheckForDefaultConstruct(Type desugared, Parameter parameter) { Method ctor = parameter.DefaultArgument.Declaration as Method; if (ctor == null || !ctor.IsConstructor) return false; Type type; desugared.IsPointerTo(out type); type = type ?? desugared; Class decl; if (!type.TryGetClass(out decl)) return false; TypeMap typeMap; if (Driver.TypeDatabase.FindTypeMap(decl, type, out typeMap)) { string mappedTo; if (Driver.Options.IsCSharpGenerator) { var typePrinterContext = new CSharpTypePrinterContext { CSharpKind = CSharpTypePrinterContextKind.Managed, Type = type }; mappedTo = typeMap.CSharpSignature(typePrinterContext); } else { var typePrinterContext = new CLITypePrinterContext { Type = type }; mappedTo = typeMap.CLISignature(typePrinterContext); } if (mappedTo == "string" && ctor.Parameters.Count == 0) { parameter.DefaultArgument.String = "\"\""; return true; } } parameter.DefaultArgument.String = string.Format("new {0}", parameter.DefaultArgument.String); if (ctor.Parameters.Count > 0 && ctor.Parameters[0].OriginalName == "_0") parameter.DefaultArgument.String = parameter.DefaultArgument.String.Replace("(0)", "()"); return decl.IsValueType ? true : (bool?) null; }
public override Type CSharpSignatureType(CSharpTypePrinterContext ctx) { var templateArgument = ((TemplateSpecializationType)ctx.Type.Desugar()).Arguments[0]; return(templateArgument.Type.Type); }
private bool? CheckForDefaultConstruct(Type desugared, Expression arg) { // Unwrapping the underlying type behind a possible pointer/reference Type type; desugared.IsPointerTo(out type); type = type ?? desugared; Class decl; if (!type.TryGetClass(out decl)) return false; var ctor = arg.Declaration as Method; TypeMap typeMap; if (Driver.TypeDatabase.FindTypeMap(decl, type, out typeMap)) { Type typeInSignature; string mappedTo; if (Driver.Options.IsCSharpGenerator) { var typePrinterContext = new CSharpTypePrinterContext { CSharpKind = CSharpTypePrinterContextKind.Managed, Type = type }; typeInSignature = typeMap.CSharpSignatureType(typePrinterContext).SkipPointerRefs(); mappedTo = typeMap.CSharpSignature(typePrinterContext); } else { var typePrinterContext = new CLITypePrinterContext { Type = type }; typeInSignature = typeMap.CLISignatureType(typePrinterContext).SkipPointerRefs(); mappedTo = typeMap.CLISignature(typePrinterContext); } Enumeration @enum; if (typeInSignature.TryGetEnum(out @enum)) { return false; } if (ctor == null || !ctor.IsConstructor) return false; if (mappedTo == "string" && ctor.Parameters.Count == 0) { arg.String = "\"\""; return true; } } if (regexCtor.IsMatch(arg.String)) { arg.String = string.Format("new {0}", arg.String); if (ctor != null && ctor.Parameters.Count > 0 && ctor.Parameters[0].Type.IsAddress()) { arg.String = arg.String.Replace("(0)", "()"); return decl.IsValueType ? true : (bool?) null; } } else { if (ctor != null && ctor.Parameters.Count > 0) { var finalPointee = ctor.Parameters[0].Type.SkipPointerRefs().Desugar(); Enumeration @enum; if (finalPointee.TryGetEnum(out @enum)) TranslateEnumExpression(arg, finalPointee, arg.String); } } return decl.IsValueType ? true : (bool?) null; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) return "Std.Vector"; return string.Format("Std.Vector<{0}>", ctx.GetTemplateParameterList()); }
public override Type CSharpSignatureType(CSharpTypePrinterContext ctx) { return GetEnumType(ctx.Type); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return string.Empty; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) // pointless, put just so that the generated code compiles return "global::System.IntPtr"; return string.Format("System.Collections.Generic.{0}<{1}>", ctx.CSharpKind == CSharpTypePrinterContextKind.DefaultExpression ? "List" : "IList", ctx.GetTemplateParameterList()); }
public override Type CSharpSignatureType(CSharpTypePrinterContext ctx) { var type = ctx.Type.Desugar(); ClassTemplateSpecialization classTemplateSpecialization; var templateSpecializationType = type as TemplateSpecializationType; if (templateSpecializationType != null) classTemplateSpecialization = templateSpecializationType.GetClassTemplateSpecialization(); else classTemplateSpecialization = (ClassTemplateSpecialization) ((TagType) type).Declaration; return classTemplateSpecialization.Arguments[0].Type.Type; }
public virtual Type CSharpSignatureType(CSharpTypePrinterContext ctx) { return new CILType(typeof(object)); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return "global::System.IntPtr"; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return("global::System.IntPtr"); }
private bool? CheckForDefaultConstruct(Type desugared, Statement arg, TypeQualifiers qualifiers) { // Unwrapping the underlying type behind a possible pointer/reference Type type = desugared.GetFinalPointee() ?? desugared; Class decl; if (!type.TryGetClass(out decl)) return false; var ctor = arg.Declaration as Method; TypeMap typeMap; var typePrinterContext = new CSharpTypePrinterContext { CSharpKind = CSharpTypePrinterContextKind.DefaultExpression, Type = type }; string typePrinterResult = null; if (Driver.TypeDatabase.FindTypeMap(decl, type, out typeMap)) { var typeInSignature = typeMap.CSharpSignatureType( typePrinterContext).SkipPointerRefs().Desugar(); Enumeration @enum; if (typeInSignature.TryGetEnum(out @enum)) return false; if (ctor == null || !ctor.IsConstructor) return false; typePrinterResult = typeMap.CSharpSignature(typePrinterContext); if (typePrinterResult == "string" && ctor.Parameters.Count == 0) { arg.String = "\"\""; return true; } } var match = regexCtor.Match(arg.String); if (match.Success) { if (ctor != null) { var templateSpecializationType = type as TemplateSpecializationType; var typePrinter = new CSharpTypePrinter(Driver); typePrinterResult = typePrinterResult ?? (templateSpecializationType != null ? typePrinter.VisitTemplateSpecializationType( templateSpecializationType, qualifiers) : typePrinter.VisitClassDecl((Class) ctor.Namespace)).Type; arg.String = string.Format("new {0}{1}", typePrinterResult, match.Groups[2].Value); if (ctor.Parameters.Count > 0 && ctor.Parameters[0].Type.IsAddress()) arg.String = arg.String.Replace("(0)", "()"); } else arg.String = string.Format("new {0}", arg.String); } else { if (ctor != null && ctor.Parameters.Count > 0) { var finalPointee = ctor.Parameters[0].Type.SkipPointerRefs().Desugar(); Enumeration @enum; if (finalPointee.TryGetEnum(out @enum)) TranslateEnumExpression(ctor, arg, finalPointee, arg.String); } } return decl.IsValueType ? true : (bool?) null; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { var type = Type as TemplateSpecializationType; return string.Format("System.Collections.Generic.List<{0}>", type.Arguments[0].Type); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return "va_list"; }
public virtual string CSharpSignature(CSharpTypePrinterContext ctx) { throw new NotImplementedException(); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return CSharpTypePrinter.IntPtrType; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return this.CSharpSignatureType(ctx).ToString(); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return("string"); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { TemplateArgument templateArgument = ((TemplateSpecializationType) ctx.Type.Desugar()).Arguments[0]; return templateArgument.Type.Type.ToString(); }
public override Type CSharpSignatureType(CSharpTypePrinterContext ctx) { return(new TagType(new Enumeration())); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { // doesn't matter, we just need it to compile return("int"); }
public virtual Type CSharpSignatureType(CSharpTypePrinterContext ctx) { return(new CILType(typeof(object))); }
private bool?CheckForDefaultConstruct(Type desugared, Expression arg, TypeQualifiers qualifiers) { // Unwrapping the underlying type behind a possible pointer/reference Type type = desugared.GetFinalPointee() ?? desugared; Class decl; if (!type.TryGetClass(out decl)) { return(false); } var ctor = arg.Declaration as Method; TypeMap typeMap; var typePrinterContext = new CSharpTypePrinterContext { CSharpKind = CSharpTypePrinterContextKind.DefaultExpression, Type = type }; string typePrinterResult = null; if (Driver.TypeDatabase.FindTypeMap(decl, type, out typeMap)) { var typeInSignature = typeMap.CSharpSignatureType(typePrinterContext).SkipPointerRefs(); Enumeration @enum; if (typeInSignature.TryGetEnum(out @enum)) { return(false); } if (ctor == null || !ctor.IsConstructor) { return(false); } typePrinterResult = typeMap.CSharpSignature(typePrinterContext); if (typePrinterResult == "string" && ctor.Parameters.Count == 0) { arg.String = "\"\""; return(true); } } var match = regexCtor.Match(arg.String); if (match.Success) { if (ctor != null) { var templateSpecializationType = type as TemplateSpecializationType; var typePrinter = new CSharpTypePrinter(Driver); typePrinterResult = typePrinterResult ?? (templateSpecializationType != null ? typePrinter.VisitTemplateSpecializationType(templateSpecializationType, qualifiers) : typePrinter.VisitClassDecl((Class)ctor.Namespace)).Type; arg.String = string.Format("new {0}{1}", typePrinterResult, match.Groups[2].Value); if (ctor.Parameters.Count > 0 && ctor.Parameters[0].Type.IsAddress()) { arg.String = arg.String.Replace("(0)", "()"); } } else { arg.String = string.Format("new {0}", arg.String); } } else { if (ctor != null && ctor.Parameters.Count > 0) { var finalPointee = ctor.Parameters[0].Type.SkipPointerRefs().Desugar(); Enumeration @enum; if (finalPointee.TryGetEnum(out @enum)) { TranslateEnumExpression(arg, finalPointee, arg.String); } } } return(decl.IsValueType ? true : (bool?)null); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { // doesn't matter, we just need it to compile return "int"; }
public virtual string CSharpSignature(CSharpTypePrinterContext ctx) { throw new NotImplementedException(); }
public override Type CSharpSignatureType(CSharpTypePrinterContext ctx) { var templateArgument = ((TemplateSpecializationType) ctx.Type.Desugar()).Arguments[0]; return templateArgument.Type.Type; }
private bool?CheckForDefaultConstruct(Type desugared, Expression arg) { // Unwrapping the underlying type behind a possible pointer/reference Type type; desugared.IsPointerTo(out type); type = type ?? desugared; Class decl; if (!type.TryGetClass(out decl)) { return(false); } var ctor = arg.Declaration as Method; TypeMap typeMap; if (Driver.TypeDatabase.FindTypeMap(decl, type, out typeMap)) { Type typeInSignature; string mappedTo; if (Driver.Options.IsCSharpGenerator) { var typePrinterContext = new CSharpTypePrinterContext { CSharpKind = CSharpTypePrinterContextKind.Managed, Type = type }; typeInSignature = typeMap.CSharpSignatureType(typePrinterContext).SkipPointerRefs(); mappedTo = typeMap.CSharpSignature(typePrinterContext); } else { var typePrinterContext = new CLITypePrinterContext { Type = type }; typeInSignature = typeMap.CLISignatureType(typePrinterContext).SkipPointerRefs(); mappedTo = typeMap.CLISignature(typePrinterContext); } Enumeration @enum; if (typeInSignature.TryGetEnum(out @enum)) { return(false); } if (ctor == null || !ctor.IsConstructor) { return(false); } if (mappedTo == "string" && ctor.Parameters.Count == 0) { arg.String = "\"\""; return(true); } } if (regexCtor.IsMatch(arg.String)) { arg.String = string.Format("new {0}", arg.String); if (ctor != null && ctor.Parameters.Count > 0 && ctor.Parameters[0].Type.IsAddress()) { arg.String = arg.String.Replace("(0)", "()"); return(decl.IsValueType ? true : (bool?)null); } } else { if (ctor != null && ctor.Parameters.Count > 0) { var finalPointee = ctor.Parameters[0].Type.SkipPointerRefs().Desugar(); Enumeration @enum; if (finalPointee.TryGetEnum(out @enum)) { TranslateEnumExpression(arg, finalPointee, arg.String); } } } return(decl.IsValueType ? true : (bool?)null); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return "va_list"; }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return "Std.String"; }
public override Type CSharpSignatureType(CSharpTypePrinterContext ctx) { return(GetEnumType(ctx.Type)); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { return(CSharpTypePrinter.IntPtrType); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native) { if (Type.IsAddress()) { return "QList.Internal*"; } return "QList.Internal"; } TemplateSpecializationType templateSpecialization = (TemplateSpecializationType) ctx.Type.Desugar(); TemplateArgument templateArgument = templateSpecialization.Arguments[0]; if (templateArgument.Type.Type.IsPointerToPrimitiveType()) { return "System.Collections.Generic.IList<global::System.IntPtr>"; } return string.Format("System.Collections.Generic.IList<{0}>", ctx.GetTemplateParameterList()); }
public override string CSharpSignature(CSharpTypePrinterContext ctx) { var fullType = ctx.FullType.Type; var isPointer = (fullType != null) && (fullType is PointerType || fullType.Desugar() is TemplateSpecializationType); if (ctx.CSharpKind == CSharpTypePrinterContextKind.Native && isPointer) return "global::System.IntPtr"; var type = Type as TemplateSpecializationType; return string.Format("{0}", type.Arguments[0].Type); }