/// <summary> /// Default ctor /// </summary> public CodeTypeReferenceBuilder(NetTypeDefinition context, bool useShortTypeNames, bool useShortNestedTypeNames, bool allowVoid, TypeNameMap typeNameMap) { this.context = context; this.useShortTypeNames = useShortTypeNames; this.useShortNestedTypeNames = useShortNestedTypeNames; this.allowVoid = allowVoid; this.typeNameMap = typeNameMap; }
/// <summary> /// Default ctor /// </summary> public TargetFramework(ITypeMapResolver resolver, AssemblyClassLoader assemblyClassLoader, DocModel xmlModel, Action <string> missingParamTypeReport, bool importAsStubs, bool importPublicOnly, IEnumerable <string> excludedPackages) { this.missingParamTypeReport = missingParamTypeReport; this.importAsStubs = importAsStubs; this.importPublicOnly = importPublicOnly; XmlModel = xmlModel; typeNameMap = new TypeNameMap(resolver, assemblyClassLoader); this.excludedPackages = new HashSet <string>(excludedPackages); }
/// <summary> /// Default ctor /// </summary> public TargetFramework(ITypeMapResolver resolver, AssemblyClassLoader assemblyClassLoader, DocModel xmlModel, Action<string> missingParamTypeReport, bool importAsStubs, bool importPublicOnly, IEnumerable<string> excludedPackages) { this.missingParamTypeReport = missingParamTypeReport; this.importAsStubs = importAsStubs; this.importPublicOnly = importPublicOnly; XmlModel = xmlModel; typeNameMap = new TypeNameMap(resolver, assemblyClassLoader); this.excludedPackages = new HashSet<string>(excludedPackages); }
/// <summary> /// Try to resolve the given NET name. /// </summary> void ITypeMapResolver.TryResolve(Type netType, TypeNameMap typeNameMap) { // Auto create a typedef. var typeDef = new NetTypeDefinition(ClassFile.Empty, target, AttributeConstants.Dot42Scope) { Namespace = netType.Namespace, Name = netType.Name }; typeNameMap.Add(netType.FullName, typeDef); }
/// <summary> /// Default ctor /// </summary> public NetTypeImplementationBuilder(TypeNameMap typeNameMap, ClassFile classFile, NetTypeDefinition typeDef, AssemblyClassLoader.DexImport dexImport, List <AssemblyClassLoader.DexImportMethod> dexMethods, Func <TypeDefinition, AssemblyClassLoader.DexImport> type2DexImport) { this.typeNameMap = typeNameMap; this.classFile = classFile; this.typeDef = typeDef; this.dexMethods = dexMethods; this.type2DexImport = type2DexImport; this.dexImport = dexImport; }
/// <summary> /// Try to resolve the given java class name. /// </summary> void ITypeMapResolver.TryResolve(string javaClassName, TypeNameMap typeNameMap) { // Do nothing }
/// <summary> /// Create type attributes /// </summary> private static MethodAttributes GetAttributes(NetTypeDefinition declaringType, NetMethodDefinition method, MethodDefinition javaMethod, string methodName, TypeNameMap typeNameMap) { var result = (MethodAttributes)0; var isStatic = javaMethod.IsStatic; if (javaMethod.IsPublic) { result |= MethodAttributes.Public; } else if (javaMethod.IsProtected) { result |= MethodAttributes.FamORAssem; } else if (javaMethod.IsPrivate) { result |= MethodAttributes.Private; } else if (javaMethod.IsPackagePrivate) { result |= MethodAttributes.Assembly; } if (isStatic) { result |= MethodAttributes.Static; } if (javaMethod.IsAbstract) { result |= MethodAttributes.Abstract; } if (declaringType.IsInterface) { result |= MethodAttributes.Abstract; } if ((!javaMethod.IsFinal) && !isStatic && (methodName != ".ctor") && (!declaringType.IsStruct)) { result |= MethodAttributes.Virtual; } else { result |= MethodAttributes.Final; } if (methodName == ".cctor") { result |= MethodAttributes.Static; } if (declaringType.IsSealed) { result &= ~MethodAttributes.Virtual; } return(result); }
/// <summary> /// Create type attributes /// </summary> private static MethodAttributes GetAttributes(NetTypeDefinition declaringType, NetMethodDefinition method, MethodDefinition javaMethod, string methodName, TypeNameMap typeNameMap) { var result = (MethodAttributes) 0; var isStatic = javaMethod.IsStatic; if (javaMethod.IsPublic) result |= MethodAttributes.Public; else if (javaMethod.IsProtected) result |= MethodAttributes.FamORAssem; else if (javaMethod.IsPrivate) result |= MethodAttributes.Private; else if (javaMethod.IsPackagePrivate) result |= MethodAttributes.Assembly; if (isStatic) result |= MethodAttributes.Static; if (javaMethod.IsAbstract) result |= MethodAttributes.Abstract; if (declaringType.IsInterface) result |= MethodAttributes.Abstract; if ((!javaMethod.IsFinal) && !isStatic && (methodName != ".ctor") && (!declaringType.IsStruct)) { result |= MethodAttributes.Virtual; } else { result |= MethodAttributes.Final; } if (methodName == ".cctor") { result |= MethodAttributes.Static; } if (declaringType.IsSealed) { result &= ~MethodAttributes.Virtual; } return result; }
/// <summary> /// Try to resolve the given NET name. /// </summary> void ITypeMapResolver.TryResolve(Type netType, TypeNameMap typeNameMap) { // Auto create a typedef. var typeDef = new NetTypeDefinition(ClassFile.Empty, target, AttributeConstants.Dot42Scope) { Namespace = netType.Namespace, Name = netType.Name}; typeNameMap.Add(netType.FullName, typeDef); }
/// <summary> /// Try to resolve the given java class name. /// </summary> void ITypeMapResolver.TryResolve(string javaClassName, TypeNameMap typeNameMap) { // Do nothing }
/// <summary> /// Default ctor /// </summary> public Resolver(INetGenericParameterProvider context, TypeNameMap typeNameMap) { this.context = context; this.typeNameMap = typeNameMap; }
/// <summary> /// Resolve all generic parameters in the given type in the given context. /// </summary> internal static bool TryResolve(NetTypeReference type, INetGenericParameterProvider context, TypeNameMap typeNameMap, out NetTypeReference result) { result = null; if (type == null) { return(false); } if (context == null) { throw new ArgumentNullException("context"); } result = type.Accept(new Resolver(context, typeNameMap), 0); return(result != null); }
/// <summary> /// Resolve all generic parameters in the given type in the given context. /// </summary> internal static NetTypeReference Resolve(NetTypeReference type, INetGenericParameterProvider context, TypeNameMap typeNameMap) { if (type == null) { return(null); } NetTypeReference result; if (!TryResolve(type, context, typeNameMap, out result)) { throw new ArgumentException(string.Format("Cannot resolve {0} in context of {1}", type, context)); } return(result); }