Пример #1
0
 /// <summary>
 /// Visit a <see cref="NRStruct"/>.
 /// </summary>
 /// <param name="nrStruct">The <see cref="NRStruct"/> to visit.</param>
 public void Visit(NRStruct nrStruct)
 {
     OutputLine("NRStruct");
     indent++;
     PrintMembers(nrStruct);
     indent--;
 }
Пример #2
0
        /// <summary>
        ///     Gets the <see cref="NRStruct" /> as a C# string. Only the head of the struct
        ///     is returned.
        /// </summary>
        /// <param name="nrStruct">The struct to get the code for.</param>
        /// <returns>A string representing the struct header.</returns>
        public static string Declaration(this NRStruct nrStruct)
        {
            string accessModifier    = AddSpace(nrStruct.AccessModifier.Declaration( ));
            string genericDecl       = GetGenericDefinition(nrStruct);
            string baseDecl          = GetImplementedInterfaces(nrStruct);
            string genericConstraint = GetGenericConstraint(nrStruct);

            return(string.Format("{0}struct {1}{2}{3}{4}", accessModifier, nrStruct.Name, genericDecl, baseDecl, genericConstraint));
        }
Пример #3
0
 /// <summary>
 ///     Determines if a struct will be reflected.
 /// </summary>
 /// <param name="nrStruct">The struct to test.</param>
 /// <returns><c>True</c> if the struct should be reflected.</returns>
 public bool Reflect(NRStruct nrStruct)
 {
     if (Filter.Reflect(nrStruct))
     {
         ReflectedStructures++;
         return(true);
     }
     IgnoredStructures++;
     return(false);
 }
Пример #4
0
        /// <summary>
        /// Visit a <see cref="NRStruct"/>.
        /// </summary>
        /// <param name="nrStruct">The <see cref="NRStruct"/> to visit.</param>
        public void Visit(NRStruct nrStruct)
        {
            if (!string.IsNullOrWhiteSpace(nrStruct.DeclaringTypeFullName) && (currentType != null && nrStruct.DeclaringTypeFullName != currentType.FullName || currentType == null))
            {
                // Do not output the struct since it is nested and we are not inside the parent type.
                return;
            }
            NRTypeBase oldCurrentType = currentType;

            currentType = nrStruct;

            VisitAttributes(nrStruct);

            OutputLine(nrStruct.Declaration());
            OutputLine("{");
            indent++;
            foreach (NRField nrField in nrStruct.Fields)
            {
                nrField.Accept(this);
            }
            foreach (NRConstructor nrConstructor in nrStruct.Constructors)
            {
                nrConstructor.Accept(this);
            }
            foreach (NRProperty nrProperty in nrStruct.Properties)
            {
                nrProperty.Accept(this);
            }
            foreach (NREvent nrEvent in nrStruct.Events)
            {
                nrEvent.Accept(this);
            }
            foreach (NRMethod nrMethod in nrStruct.Methods)
            {
                nrMethod.Accept(this);
            }
            VisitNestedTypes(nrStruct);
            indent--;
            OutputLine("}");
            OutputEmptyLineAfterType();

            currentType = oldCurrentType;
        }
Пример #5
0
 /// <summary>
 /// Visit a <see cref="NRStruct"/>.
 /// </summary>
 /// <param name="nrStruct">The <see cref="NRStruct"/> to visit.</param>
 public void Visit(NRStruct nrStruct)
 {
     VisitAttributes(nrStruct);
     Output(ToString(nrStruct.AccessModifier) + "struct " + nrStruct.Name + GetGenericDefinition(nrStruct));
     PrintBaseTypeAndInterfaces(nrStruct);
     VisitTypeParameters(nrStruct);
     OutputLine("");
     OutputLine("{");
     indent++;
     foreach (NRField nrField in nrStruct.Fields)
     {
         nrField.Accept(this);
     }
     foreach (NRProperty nrProperty in nrStruct.Properties)
     {
         nrProperty.Accept(this);
     }
     foreach (NRConstructor nrConstructor in nrStruct.Constructors)
     {
         nrConstructor.Accept(this);
     }
     foreach (NRMethod nrMethod in nrStruct.Methods)
     {
         nrMethod.Accept(this);
     }
     foreach (NROperator nrOperator in nrStruct.Operators)
     {
         nrOperator.Accept(this);
     }
     foreach (NREvent nrEvent in nrStruct.Events)
     {
         nrEvent.Accept(this);
     }
     indent--;
     OutputLine("}");
 }
Пример #6
0
 /// <summary>
 /// Determines if a struct will be reflected.
 /// </summary>
 /// <param name="nrStruct">The struct to test.</param>
 /// <returns>
 /// <c>True</c> if the struct should be reflected.
 /// </returns>
 public bool Reflect(NRStruct nrStruct)
 {
     return(filter.Reflect(nrStruct));
 }
Пример #7
0
 /// <summary>
 /// Determines if a struct will be reflected.
 /// </summary>
 /// <param name="nrStruct">The struct to test.</param>
 /// <returns>
 /// <c>True</c> if the struct should be reflected.
 /// </returns>
 public bool Reflect(NRStruct nrStruct)
 {
   return filter.Reflect(nrStruct);
 }
Пример #8
0
 /// <summary>
 ///     Determines if a struct will be reflected.
 /// </summary>
 /// <param name="nrStruct">The struct to test.</param>
 /// <returns><c>True</c> if the struct should be reflected.</returns>
 public bool Reflect(NRStruct nrStruct)
 {
     return(Reflect(FilterElements.Struct, nrStruct));
 }
Пример #9
0
 /// <summary>
 ///     Determines if a struct will be reflected.
 /// </summary>
 /// <param name="nrStruct">The struct to test.</param>
 /// <returns><c>True</c> if the struct should be reflected.</returns>
 public bool Reflect(NRStruct nrStruct)
 {
     return(true);
 }