/// <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; }
/// <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--; }
/// <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); }
/// <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("}"); }
/// <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)); }
/// <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); }
/// <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)); }
/// <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); }