Пример #1
0
        /// <summary>
        ///     Gets the <see cref="NRDelegate" /> as a C# string.
        /// </summary>
        /// <param name="nrDelegate">The delegate to get the code for.</param>
        /// <returns>A string representing the delegate.</returns>
        public static string Declaration(this NRDelegate nrDelegate)
        {
            string accessModifier    = AddSpace(nrDelegate.AccessModifier.Declaration( ));
            string genericDecl       = GetGenericDefinition(nrDelegate);
            string genericConstraint = GetGenericConstraint(nrDelegate);

            return(string.Format("{0}delegate {1} {2}{3}({4}){5}", accessModifier, nrDelegate.ReturnType.Declaration( ), nrDelegate.Name, genericDecl, nrDelegate.Parameters.Declaration( ), genericConstraint));
        }
Пример #2
0
 /// <summary>
 /// Visit a <see cref="NRDelegate"/>.
 /// </summary>
 /// <param name="nrDelegate">The <see cref="NRDelegate"/> to visit.</param>
 public void Visit(NRDelegate nrDelegate)
 {
     VisitAttributes(nrDelegate);
     Output(ToString(nrDelegate.AccessModifier) + "delegate " + ToString(nrDelegate.ReturnType) + " " + nrDelegate.Name + GetGenericDefinition(nrDelegate) + "(");
     PrintParameters(nrDelegate.Parameters);
     Output(")", 0);
     VisitTypeParameters(nrDelegate);
     OutputLine("");
 }
Пример #3
0
 /// <summary>
 /// Visit a <see cref="NRDelegate"/>.
 /// </summary>
 /// <param name="nrDelegate">The <see cref="NRDelegate"/> to visit.</param>
 public void Visit(NRDelegate nrDelegate)
 {
     OutputLine("NRDelegate");
     indent++;
     PrintMembers(nrDelegate);
     nrDelegate.Parameters.ForEach(nrParameter => nrParameter.Accept(this));
     nrDelegate.ReturnType.Accept(this);
     indent--;
 }
Пример #4
0
 /// <summary>
 ///     Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns><c>True</c> if the delegate should be reflected.</returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
     if (Filter.Reflect(nrDelegate))
     {
         ReflectedDelegates++;
         return(true);
     }
     IgnoredDelegates++;
     return(false);
 }
Пример #5
0
        /// <summary>
        /// Visit a <see cref="NRDelegate"/>.
        /// </summary>
        /// <param name="nrDelegate">The <see cref="NRDelegate"/> to visit.</param>
        public void Visit(NRDelegate nrDelegate)
        {
            if (!string.IsNullOrWhiteSpace(nrDelegate.DeclaringTypeFullName) && (currentType != null && nrDelegate.DeclaringTypeFullName != currentType.FullName || currentType == null))
            {
                // Do not output the delegate since it is nested and we are not inside the parent type.
                return;
            }

            VisitAttributes(nrDelegate);

            OutputLine(nrDelegate.Declaration() + ";");
            OutputEmptyLineAfterType();
        }
Пример #6
0
 /// <summary>
 /// Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns>
 /// <c>True</c> if the delegate should be reflected.
 /// </returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
     return(IsUnsafePointer(nrDelegate.ReturnType.ToString()) || HasUnsafeParameters(nrDelegate.Parameters) ? false : filter.Reflect(nrDelegate));
 }
Пример #7
0
 /// <summary>
 /// Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns>
 /// <c>True</c> if the delegate should be reflected.
 /// </returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
   return IsUnsafePointer(nrDelegate.ReturnType) || HasUnsafeParameters(nrDelegate.Parameters) ? false : filter.Reflect(nrDelegate);
 }
Пример #8
0
 /// <summary>
 ///     Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns><c>True</c> if the delegate should be reflected.</returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
     return(Reflect(FilterElements.Delegate, nrDelegate));
 }
Пример #9
0
 /// <summary>
 ///     Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns><c>True</c> if the delegate should be reflected.</returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
     return(true);
 }
Пример #10
0
 /// <summary>
 ///     Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns><c>True</c> if the delegate should be reflected.</returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
     return(!Filter.Reflect(nrDelegate));
 }
Пример #11
0
 /// <summary>
 /// Determines if a delegate will be reflected.
 /// </summary>
 /// <param name="nrDelegate">The delegate to test.</param>
 /// <returns>
 /// <c>True</c> if the delegate should be reflected.
 /// </returns>
 public bool Reflect(NRDelegate nrDelegate)
 {
     return(filter.Reflect(nrDelegate) && CanImportParameters(nrDelegate.Parameters) && CanImportTypeUsage(nrDelegate.ReturnType));
 }