示例#1
0
        /// <summary>
        /// Visit a <see cref="NREnum"/>.
        /// </summary>
        /// <param name="nrEnum">The <see cref="NREnum"/> to visit.</param>
        public void Visit(NREnum nrEnum)
        {
            if (!string.IsNullOrWhiteSpace(nrEnum.DeclaringTypeFullName) && (currentType != null && nrEnum.DeclaringTypeFullName != currentType.FullName || currentType == null))
            {
                // Do not output the enum since it is nested and we are not inside the parent type.
                return;
            }
            NRTypeBase oldCurrentType = currentType;

            currentType = nrEnum;

            VisitAttributes(nrEnum);

            OutputLine(nrEnum.Declaration());
            OutputLine("{");
            indent++;
            foreach (NREnumValue nrEnumValue in nrEnum.Values)
            {
                nrEnumValue.Accept(this);
            }
            indent--;
            OutputLine("}");
            OutputEmptyLineAfterType();

            currentType = oldCurrentType;
        }
示例#2
0
文件: CSharp.cs 项目: Victov/NClass
        /// <summary>
        ///     Gets the <see cref="NREnum" /> as a C# string.
        /// </summary>
        /// <param name="nrEnum">The enum to get the code for.</param>
        /// <returns>A string representing the enum header.</returns>
        public static string Declaration(this NREnum nrEnum)
        {
            string accessModifier = AddSpace(nrEnum.AccessModifier.Declaration( ));
            string baseDecl       = string.IsNullOrEmpty(nrEnum.UnderlyingType) ? "" : " : " + nrEnum.UnderlyingType;

            return(string.Format("{0}enum {1}{2}", accessModifier, nrEnum.Name, baseDecl));
        }
 /// <summary>
 /// Visit a <see cref="NREnum"/>.
 /// </summary>
 /// <param name="nrEnum">The <see cref="NREnum"/> to visit.</param>
 public void Visit(NREnum nrEnum)
 {
     OutputLine("NREnum");
     indent++;
     PrintMembers(nrEnum);
     nrEnum.Values.ForEach(nrEnumValue => nrEnumValue.Accept(this));
     indent--;
 }
示例#4
0
 /// <summary>
 ///     Determines if a enum will be reflected.
 /// </summary>
 /// <param name="nrEnum">The enum to test.</param>
 /// <returns><c>True</c> if the enum should be reflected.</returns>
 public bool Reflect(NREnum nrEnum)
 {
     if (Filter.Reflect(nrEnum))
     {
         ReflectedEnums++;
         return(true);
     }
     IgnoredEnums++;
     return(false);
 }
示例#5
0
 /// <summary>
 /// Visit a <see cref="NREnum"/>.
 /// </summary>
 /// <param name="nrEnum">The <see cref="NREnum"/> to visit.</param>
 public void Visit(NREnum nrEnum)
 {
     VisitAttributes(nrEnum);
     OutputLine(ToString(nrEnum.AccessModifier) + "enum " + nrEnum.Name);
     OutputLine("{");
     indent++;
     foreach (NREnumValue nrEnumValue in nrEnum.Values)
     {
         nrEnumValue.Accept(this);
     }
     indent--;
     OutputLine("}");
 }
示例#6
0
 /// <summary>
 /// Determines if a enum will be reflected.
 /// </summary>
 /// <param name="nrEnum">The enum to test.</param>
 /// <returns>
 /// <c>True</c> if the enum should be reflected.
 /// </returns>
 public bool Reflect(NREnum nrEnum)
 {
     return(filter.Reflect(nrEnum));
 }
示例#7
0
 /// <summary>
 /// Determines if a enum will be reflected.
 /// </summary>
 /// <param name="nrEnum">The enum to test.</param>
 /// <returns>
 /// <c>True</c> if the enum should be reflected.
 /// </returns>
 public bool Reflect(NREnum nrEnum)
 {
   return filter.Reflect(nrEnum);
 }
示例#8
0
 /// <summary>
 ///     Determines if a enum will be reflected.
 /// </summary>
 /// <param name="nrEnum">The enum to test.</param>
 /// <returns><c>True</c> if the enum should be reflected.</returns>
 public bool Reflect(NREnum nrEnum)
 {
     return(Reflect(FilterElements.Enum, nrEnum));
 }
示例#9
0
 /// <summary>
 ///     Determines if a enum will be reflected.
 /// </summary>
 /// <param name="nrEnum">The enum to test.</param>
 /// <returns><c>True</c> if the enum should be reflected.</returns>
 public bool Reflect(NREnum nrEnum)
 {
     return(true);
 }