コード例 #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));
        }
コード例 #3
0
 /// <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
ファイル: StatisticFilter.cs プロジェクト: Victov/NClass
 /// <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
ファイル: NClassImportFilter.cs プロジェクト: gbaychev/NClass
 /// <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
ファイル: IncludeFilter.cs プロジェクト: Victov/NClass
 /// <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);
 }