Esempio n. 1
0
        /// <summary>
        /// Visit a <see cref="NRProperty"/>.
        /// </summary>
        /// <param name="nrProperty">The <see cref="NRProperty"/> to visit.</param>
        public void Visit(NRProperty nrProperty)
        {
            VisitAttributes(nrProperty);

            OutputLine(nrProperty.Declaration());
            OutputEmptyLineAfterMember();
        }
Esempio n. 2
0
        /// <summary>
        ///     Gets the <see cref="NRProperty" /> as a C# string.
        /// </summary>
        /// <param name="property">The property to get the code for.</param>
        /// <returns>A string representing the property.</returns>
        public static string Declaration(this NRProperty property)
        {
            string accessModifier = AddSpace(property.AccessModifier.Declaration( ));
            string modifier       = AddSpace(property.OperationModifier.Declaration( ));
            string parameter      = "";
            string getter         = "";
            string setter         = "";

            if (property.Parameters.Count > 0)
            {
                parameter = "[" + property.Parameters.Declaration( ) + "]";
            }
            if (property.HasGetter)
            {
                string getterModifier = "";
                if (property.GetterModifier > property.AccessModifier)
                {
                    getterModifier = AddSpace(property.GetterModifier.Declaration( ));
                }
                getter = AddSpace(getterModifier + "get;");
            }
            if (property.HasSetter)
            {
                string setterModifier = "";
                if (property.SetterModifier > property.AccessModifier)
                {
                    setterModifier = AddSpace(property.SetterModifier.Declaration( ));
                }
                setter = AddSpace(setterModifier + "set;");
            }

            return(string.Format("{0}{1}{2} {3}{4}{{ {5}{6}}}", accessModifier, modifier, property.Type.Declaration( ), property.Name, parameter, getter, setter));
        }
Esempio n. 3
0
 /// <summary>
 ///     Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns><c>True</c> if the property should be reflected.</returns>
 public bool Reflect(NRProperty nrProperty)
 {
     if (Filter.Reflect(nrProperty))
     {
         ReflectedProperties++;
         return(true);
     }
     IgnoredProperties++;
     return(false);
 }
 /// <summary>
 /// Visit a <see cref="NRProperty"/>.
 /// </summary>
 /// <param name="nrProperty">The <see cref="NRProperty"/> to visit.</param>
 public void Visit(NRProperty nrProperty)
 {
     OutputLine("NRProperty");
     indent++;
     PrintMembers(nrProperty);
     OutputLine("GetterModifier: " + nrProperty.GetterModifier);
     OutputLine("HasGetter: " + nrProperty.HasGetter);
     OutputLine("HasSetter: " + nrProperty.HasSetter);
     OutputLine("SetterModifier: " + nrProperty.SetterModifier);
     indent--;
 }
Esempio n. 5
0
        /// <summary>
        /// Visit a <see cref="NRProperty"/>.
        /// </summary>
        /// <param name="nrProperty">The <see cref="NRProperty"/> to visit.</param>
        public void Visit(NRProperty nrProperty)
        {
            VisitAttributes(nrProperty);
            string methods = "";

            if (nrProperty.HasGetter)
            {
                methods = ToString(nrProperty.GetterModifier) + "get ";
            }
            if (nrProperty.HasSetter)
            {
                methods += ToString(nrProperty.SetterModifier) + "set ";
            }
            Output(ToString(nrProperty.AccessModifier) + ToString(nrProperty.OperationModifier) + ToString(nrProperty.Type) + " " +
                   nrProperty.Name);
            if (nrProperty.Parameters.Count > 0)
            {
                Output("[", 0);
                PrintParameters(nrProperty.Parameters);
                Output("]", 0);
            }
            OutputLine(" { " + methods + "}", 0);
        }
Esempio n. 6
0
 /// <summary>
 /// Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns>
 /// <c>True</c> if the property should be reflected.
 /// </returns>
 public bool Reflect(NRProperty nrProperty)
 {
     return(IsUnsafePointer(nrProperty.Type.Name) ? false : filter.Reflect(nrProperty));
 }
Esempio n. 7
0
 public NRPropertyDeclaration(NRProperty property)
 {
     this.property = property;
 }
Esempio n. 8
0
 /// <summary>
 /// Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns>
 /// <c>True</c> if the property should be reflected.
 /// </returns>
 public bool Reflect(NRProperty nrProperty)
 {
   return IsUnsafePointer(nrProperty.Type) ? false : filter.Reflect(nrProperty);
 }
Esempio n. 9
0
 /// <summary>
 ///     Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns><c>True</c> if the property should be reflected.</returns>
 public bool Reflect(NRProperty nrProperty)
 {
     return(Reflect(FilterElements.Property, nrProperty));
 }
Esempio n. 10
0
 /// <summary>
 ///     Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns><c>False</c> if the property should not be reflected.</returns>
 public bool Reflect(NRProperty nrProperty)
 {
     return(true);
 }
Esempio n. 11
0
 /// <summary>
 ///     Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns><c>True</c> if the property should be reflected.</returns>
 public bool Reflect(NRProperty nrProperty)
 {
     return(!Filter.Reflect(nrProperty));
 }
Esempio n. 12
0
 /// <summary>
 /// Determines if a property will be reflected.
 /// </summary>
 /// <param name="nrProperty">The property to test.</param>
 /// <returns>
 /// <c>True</c> if the property should be reflected.
 /// </returns>
 public bool Reflect(NRProperty nrProperty)
 {
     return(filter.Reflect(nrProperty) && CanImportTypeUsage(nrProperty.Type));
 }