/// <summary> /// Gets the <see cref="NRField" /> as a C# string. /// </summary> /// <param name="field">The field to get the code for.</param> /// <returns>A string representing the field.</returns> public static string Declaration(this NRField field) { string accessModifier = AddSpace(field.AccessModifier.Declaration( )); string modifier = AddSpace(field.FieldModifier.Declaration( )); string value = ""; if (!string.IsNullOrWhiteSpace(field.InitialValue) || field.IsConstant) { if (field.InitialValue == null) { value = " = null"; } else if (field.Type.Name == "String") { value = " = \"" + EscapeString(field.InitialValue) + "\""; } else if (field.Type.Name == "Char") { value = " = '" + EscapeString(field.InitialValue) + "'"; } else { value = " = " + field.InitialValue; } } return(string.Format("{0}{1}{2} {3}{4}", accessModifier, modifier, field.Type.Declaration( ), field.Name, value)); }
/// <summary> /// Visit a <see cref="NRField"/>. /// </summary> /// <param name="nrField">The <see cref="NRField"/> to visit.</param> public void Visit(NRField nrField) { VisitAttributes(nrField); OutputLine(nrField.Declaration() + ";"); OutputEmptyLineAfterMember(); }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns><c>True</c> if the field should be reflected.</returns> public bool Reflect(NRField nrField) { FilterModifiers filterModifiers = GetFilterModifier(nrField.AccessModifier); filterModifiers |= nrField.FieldModifier == FieldModifier.Static ? FilterModifiers.Static : FilterModifiers.Instance; FilterElements filterElement = nrField.IsConstant ? FilterElements.Constant : FilterElements.Field; return(RuleMatch(filterElement, filterModifiers)); }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns><c>True</c> if the field should be reflected.</returns> public bool Reflect(NRField nrField) { if (Filter.Reflect(nrField)) { ReflectedFields++; return(true); } IgnoredFields++; return(false); }
/// <summary> /// Visit a <see cref="NRField"/>. /// </summary> /// <param name="nrField">The <see cref="NRField"/> to visit.</param> public void Visit(NRField nrField) { VisitAttributes(nrField); string value = ""; if (nrField.IsConstant) { value = ": " + (nrField.InitialValue ?? "null"); } OutputLine(ToString(nrField.AccessModifier) + ToString(nrField.FieldModifier) + ToString(nrField.Type) + " " + nrField.Name + value); }
/// <summary> /// Visit a <see cref="NRField"/>. /// </summary> /// <param name="nrField">The <see cref="NRField"/> to visit.</param> public void Visit(NRField nrField) { OutputLine("NRField"); indent++; PrintMembers(nrField); OutputLine("FieldModifier: " + nrField.FieldModifier); OutputLine("InitialValue: " + nrField.InitialValue); OutputLine("IsConstant: " + nrField.IsConstant); OutputLine("IsHider: " + nrField.IsHider); OutputLine("IsReadonly: " + nrField.IsReadonly); OutputLine("IsStatic: " + nrField.IsStatic); OutputLine("IsVolatile: " + nrField.IsVolatile); indent--; }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns> /// <c>True</c> if the field should be reflected. /// </returns> public bool Reflect(NRField nrField) { return(IsUnsafePointer(nrField.Type.Name) ? false : filter.Reflect(nrField)); }
public NRFieldDeclaration(NRField field) { this.field = field; }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns> /// <c>True</c> if the field should be reflected. /// </returns> public bool Reflect(NRField nrField) { return IsUnsafePointer(nrField.Type) ? false : filter.Reflect(nrField); }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns><c>False</c> if the field should not be reflected.</returns> public bool Reflect(NRField nrField) { return(true); }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns><c>True</c> if the field should be reflected.</returns> public bool Reflect(NRField nrField) { return(!Filter.Reflect(nrField)); }
/// <summary> /// Determines if a field will be reflected. /// </summary> /// <param name="nrField">The field to test.</param> /// <returns> /// <c>True</c> if the field should be reflected. /// </returns> public bool Reflect(NRField nrField) { return(filter.Reflect(nrField) && CanImportTypeUsage(nrField.Type)); }