/// <summary> /// Gets the <see cref="NRMethod" /> as a C# string. /// </summary> /// <param name="method">The method to get the code for.</param> /// <returns>A string representing the method.</returns> public static string Declaration(this NRMethod method) { string accessModifier = AddSpace(method.AccessModifier.Declaration( )); string modifier = AddSpace(method.OperationModifier.Declaration( )); string genericDecl = GetGenericDefinition(method); return(string.Format("{0}{1}{2} {3}{4}({5})", accessModifier, modifier, method.Type.Declaration( ), method.Name, genericDecl, method.Parameters.Declaration( ))); }
/// <summary> /// Returns <c>true</c> if the given method is an extension method. /// </summary> /// <param name="method">The method to check.</param> /// <returns><c>true</c> if the given method is an extension method.</returns> private bool IsExtensionMethod(NRMethod method) { if (method.IsExtensionMethod) { ExtensionMethodsPresent = true; return(true); } return(false); }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns><c>True</c> if the method should be reflected.</returns> public bool Reflect(NRMethod nrMethod) { if (Filter.Reflect(nrMethod)) { ReflectedMethods++; return(true); } IgnoredMethods++; return(false); }
/// <summary> /// Visit a <see cref="NRMethod"/>. /// </summary> /// <param name="nrMethod">The <see cref="NRMethod"/> to visit.</param> public void Visit(NRMethod nrMethod) { VisitAttributes(nrMethod); VisitReturnValueAttributes(nrMethod); Output(ToString(nrMethod.AccessModifier) + ToString(nrMethod.OperationModifier) + ToString(nrMethod.Type) + " " + nrMethod.Name + GetGenericDefinition(nrMethod) + "("); PrintParameters(nrMethod.Parameters, nrMethod.IsExtensionMethod); Output(")", 0); VisitTypeParameters(nrMethod); OutputLine("", 0); }
/// <summary> /// Visit a <see cref="NRMethod"/>. /// </summary> /// <param name="nrMethod">The <see cref="NRMethod"/> to visit.</param> public void Visit(NRMethod nrMethod) { OutputLine("NRMethod"); indent++; PrintMembers(nrMethod); nrMethod.GenericTypes.ForEach(nrTypeParameter => nrTypeParameter.Accept(this)); OutputLine("IsExtensionMethod: " + nrMethod.IsExtensionMethod); OutputLine("IsGeneric: " + nrMethod.IsGeneric); indent--; }
/// <summary> /// Visit a <see cref="NRMethod"/>. /// </summary> /// <param name="nrMethod">The <see cref="NRMethod"/> to visit.</param> public void Visit(NRMethod nrMethod) { VisitAttributes(nrMethod); VisitReturnValueAttributes(nrMethod); Output(nrMethod.Declaration()); if (nrMethod.GenericTypes.Count > 0) { foreach (NRTypeParameter nrTypeParameter in nrMethod.GenericTypes) { nrTypeParameter.Accept(this); } } if (currentType is NRInterface || nrMethod.IsAbstract) { OutputLine(";", 0); } else { OutputLine("", 0); OutputLine("{}"); } OutputEmptyLineAfterMember(); }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns> /// <c>True</c> if the method should be reflected. /// </returns> public bool Reflect(NRMethod nrMethod) { return(IsUnsafePointer(nrMethod.Type.Name) || HasUnsafeParameters(nrMethod.Parameters) ? false : filter.Reflect(nrMethod)); }
public NRMethodDeclaration(NRMethod method) { this.method = method; }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns> /// <c>True</c> if the method should be reflected. /// </returns> public bool Reflect(NRMethod nrMethod) { return IsUnsafePointer(nrMethod.Type) || HasUnsafeParameters(nrMethod.Parameters) ? false : filter.Reflect(nrMethod); }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns><c>True</c> if the method should be reflected.</returns> public bool Reflect(NRMethod nrMethod) { return(Reflect(FilterElements.Method, nrMethod)); }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns><c>True</c>, so the method will be reflected.</returns> public bool Reflect(NRMethod nrMethod) { return(true); }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns><c>True</c> if the method should be reflected.</returns> public bool Reflect(NRMethod nrMethod) { return(!Filter.Reflect(nrMethod)); }
/// <summary> /// Determines if a method will be reflected. /// </summary> /// <param name="nrMethod">The method to test.</param> /// <returns> /// <c>True</c> if the method should be reflected. /// </returns> public bool Reflect(NRMethod nrMethod) { return(filter.Reflect(nrMethod) && CanImportParameters(nrMethod.Parameters) && CanImportTypeUsage(nrMethod.Type) && !IsExtensionMethod(nrMethod)); }