/// <summary> /// Gets the code for a property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="externalType">The external (exposed) type.</param> /// <param name="internalType">The internal (underlying) type.</param> /// <param name="getterVisibility">The getter visibility.</param> /// <param name="setterVisibility">The setter visibility.</param> /// <param name="member">The member.</param> /// <param name="isVirtual">If this property is virtual.</param> /// <param name="isStatic">If this property is static.</param> /// <returns>The code.</returns> public string GetProperty(string propertyName, Type externalType, Type internalType, MemberVisibilityLevel getterVisibility, MemberVisibilityLevel?setterVisibility, string member, bool isVirtual, bool isStatic) { return(GetProperty(propertyName, GetTypeString(externalType), GetTypeString(internalType), getterVisibility, setterVisibility, member, isVirtual, isStatic)); }
/// <summary> /// Gets the name and visibility to use for a method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> /// <exception cref="ArgumentException">A method cannot be both virtual and static.</exception> public virtual string GetMethodNameAndVisibility(string methodName, MemberVisibilityLevel visibility, string returnType, bool isVirtual, bool isStatic) { if (isVirtual && isStatic) { throw new ArgumentException("A method cannot be both virtual and static."); } var sb = new StringBuilder(); sb.Append(GetVisibilityLevel(visibility)); sb.Append(" "); if (isVirtual) { sb.Append(VirtualString); sb.Append(" "); } else if (isStatic) { sb.Append(StaticString); sb.Append(" "); } if (!string.IsNullOrEmpty(returnType)) { sb.Append(returnType); sb.Append(" "); } sb.Append(methodName); return(sb.ToString()); }
/// <summary> /// Gets the code for a class. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="visibility">The visibility.</param> /// <param name="isStatic">Whether or not it is a static class.</param> /// <param name="interfaces">The interfaces.</param> /// <returns>The code.</returns> public override string GetClass(string className, MemberVisibilityLevel visibility, bool isStatic, IEnumerable <string> interfaces) { var sb = new StringBuilder(); sb.Append(GetVisibilityLevel(visibility)); if (isStatic) { sb.Append(" static "); } sb.Append(" class "); sb.Append(className); if (interfaces != null && !interfaces.IsEmpty()) { sb.Append(" : "); foreach (var i in interfaces) { sb.Append(i); sb.Append(ParameterSpacer); } sb.Length -= ParameterSpacer.Length; } return(sb.ToString()); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="code">The code.</param> /// <param name="isReadonly">If this field is readonly.</param> /// <param name="isStatic">If this field is static.</param> /// <returns>The code.</returns> public override string GetField(string memberName, string type, MemberVisibilityLevel visibility, string code, bool isReadonly, bool isStatic) { var sb = new StringBuilder(); if (visibility != MemberVisibilityLevel.Private) { sb.Append(GetVisibilityLevel(visibility)); sb.Append(" "); } if (isStatic) { sb.Append(" static "); } if (isReadonly) { sb.Append(" readonly "); } sb.Append(type); sb.Append(" "); sb.Append(memberName); if (!string.IsNullOrEmpty(code)) { sb.Append(" = "); sb.Append(code); } sb.Append(EndOfLine); return(sb.ToString()); }
/// <summary> /// Gets the code for a method header. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="parameters">The parameters.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> public virtual string GetMethodHeader(string methodName, MemberVisibilityLevel visibility, MethodParameter[] parameters, string returnType, bool isVirtual, bool isStatic) { var sb = new StringBuilder(256); sb.Append(GetMethodNameAndVisibility(methodName, visibility, returnType, isVirtual, isStatic)); // Parameters sb.Append(OpenParameterString); sb.Append(GetParameters(parameters)); sb.Append(CloseParameterString); return(sb.ToString()); }
/// <summary> /// Gets the code for a constant field. /// </summary> /// <param name="fieldName">Name of the field.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <returns>The code.</returns> public override string GetConstField(string fieldName, Type type, MemberVisibilityLevel visibility, string value) { var sb = new StringBuilder(); sb.Append(GetVisibilityLevel(visibility)); sb.Append(" const "); sb.Append(GetTypeString(type)); sb.Append(" "); sb.Append(fieldName); sb.Append(" = "); sb.Append(value); sb.Append(EndOfLine); return(sb.ToString()); }
/// <summary> /// Gets the code for a property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="externalType">The external (exposed) type.</param> /// <param name="internalType">The internal (underlying) type.</param> /// <param name="getterVisibility">The getter visibility.</param> /// <param name="setterVisibility">The setter visibility.</param> /// <param name="member">The member.</param> /// <param name="isVirtual">If this property is virtual.</param> /// <param name="isStatic">If this property is static.</param> /// <returns>The code.</returns> public virtual string GetProperty(string propertyName, string externalType, string internalType, MemberVisibilityLevel getterVisibility, MemberVisibilityLevel?setterVisibility, string member, bool isVirtual, bool isStatic) { var sb = new StringBuilder(); sb.AppendLine(GetMethodNameAndVisibility(propertyName, getterVisibility, externalType, isVirtual, isStatic)); sb.AppendLine(OpenBrace); { // Getter sb.AppendLine(PropertyGetString); sb.AppendLine(OpenBrace); { sb.Append(ReturnString); sb.Append(" "); sb.Append(GetCast(externalType)); sb.Append(member); sb.AppendLine(EndOfLine); } sb.AppendLine(CloseBrace); // Setter if (setterVisibility.HasValue) { if (setterVisibility.Value != getterVisibility) { sb.Append(GetVisibilityLevel(setterVisibility.Value) + " "); } sb.AppendLine(PropertySetString); sb.AppendLine(OpenBrace); { sb.AppendLine(GetSetValue(member, PropertyValue, true, false, internalType)); } sb.AppendLine(CloseBrace); } } sb.Append(CloseBrace); return(sb.ToString()); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="inputName">The name of the field (can be aliased).</param> /// <param name="visibility">The visibility.</param> /// <param name="type">The type.</param> /// <returns>The code.</returns> public virtual string GetFieldName(string inputName, MemberVisibilityLevel visibility, string type) { if (ApplyAlias(ref inputName)) { if (visibility != MemberVisibilityLevel.Private) { return(inputName); } } inputName = RemoveSeparatorCharacters(inputName); switch (visibility) { case MemberVisibilityLevel.Private: // Prefix _ and make the first character lowercase return("_" + inputName.Substring(0, 1).ToLower() + inputName.Substring(1)); default: // Make first character uppercase return(inputName.Substring(0, 1).ToUpper() + inputName.Substring(1)); } }
/// <summary> /// Gets the code to represent a visibility level. /// </summary> /// <param name="visibility">The visibility level.</param> /// <returns>The code.</returns> /// <exception cref="ArgumentOutOfRangeException"><c>visibility</c> contains an undefined /// <see cref="MemberVisibilityLevel"/> value.</exception> public override string GetVisibilityLevel(MemberVisibilityLevel visibility) { switch (visibility) { case MemberVisibilityLevel.Private: return("private"); case MemberVisibilityLevel.Public: return("public"); case MemberVisibilityLevel.Internal: return("internal"); case MemberVisibilityLevel.Protected: return("protected"); case MemberVisibilityLevel.ProtectedInternal: return("protected internal"); default: throw new ArgumentOutOfRangeException("visibility"); } }
/// <summary> /// Gets the code for a property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="externalType">The external (exposed) type.</param> /// <param name="internalType">The internal (underlying) type.</param> /// <param name="getterVisibility">The getter visibility.</param> /// <param name="setterVisibility">The setter visibility.</param> /// <param name="member">The member.</param> /// <param name="isVirtual">If this property is virtual.</param> /// <param name="isStatic">If this property is static.</param> /// <returns>The code.</returns> public virtual string GetProperty(string propertyName, string externalType, string internalType, MemberVisibilityLevel getterVisibility, MemberVisibilityLevel? setterVisibility, string member, bool isVirtual, bool isStatic) { var sb = new StringBuilder(); sb.AppendLine(GetMethodNameAndVisibility(propertyName, getterVisibility, externalType, isVirtual, isStatic)); sb.AppendLine(OpenBrace); { // Getter sb.AppendLine(PropertyGetString); sb.AppendLine(OpenBrace); { sb.Append(ReturnString); sb.Append(" "); sb.Append(GetCast(externalType)); sb.Append(member); sb.AppendLine(EndOfLine); } sb.AppendLine(CloseBrace); // Setter if (setterVisibility.HasValue) { if (setterVisibility.Value != getterVisibility) sb.Append(GetVisibilityLevel(setterVisibility.Value) + " "); sb.AppendLine(PropertySetString); sb.AppendLine(OpenBrace); { sb.AppendLine(GetSetValue(member, PropertyValue, true, false, internalType)); } sb.AppendLine(CloseBrace); } } sb.Append(CloseBrace); return sb.ToString(); }
/// <summary> /// Gets the code for a constant field. /// </summary> /// <param name="fieldName">Name of the field.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <returns>The code.</returns> public abstract string GetConstField(string fieldName, Type type, MemberVisibilityLevel visibility, string value);
/// <summary> /// Gets the code for a method header. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="parameters">The parameters.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> public virtual string GetMethodHeader(string methodName, MemberVisibilityLevel visibility, MethodParameter[] parameters, string returnType, bool isVirtual, bool isStatic) { var sb = new StringBuilder(256); sb.Append(GetMethodNameAndVisibility(methodName, visibility, returnType, isVirtual, isStatic)); // Parameters sb.Append(OpenParameterString); sb.Append(GetParameters(parameters)); sb.Append(CloseParameterString); return sb.ToString(); }
/// <summary> /// Gets the name and visibility to use for a method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> /// <exception cref="ArgumentException">A method cannot be both virtual and static.</exception> public virtual string GetMethodNameAndVisibility(string methodName, MemberVisibilityLevel visibility, string returnType, bool isVirtual, bool isStatic) { if (isVirtual && isStatic) throw new ArgumentException("A method cannot be both virtual and static."); var sb = new StringBuilder(); sb.Append(GetVisibilityLevel(visibility)); sb.Append(" "); if (isVirtual) { sb.Append(VirtualString); sb.Append(" "); } else if (isStatic) { sb.Append(StaticString); sb.Append(" "); } if (!string.IsNullOrEmpty(returnType)) { sb.Append(returnType); sb.Append(" "); } sb.Append(methodName); return sb.ToString(); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="inputName">The name of the field (can be aliased).</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public string GetFieldName(string inputName, MemberVisibilityLevel visibility, Type type) { return GetFieldName(inputName, visibility, GetTypeString(type)); }
/// <summary> /// Gets the code for an interface. /// </summary> /// <param name="interfaceName">The interface name.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public abstract string GetInterface(string interfaceName, MemberVisibilityLevel visibility);
/// <summary> /// Gets the code for a class. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="visibility">The visibility.</param> /// <param name="isStatic">Whether or not it is a static class.</param> /// <param name="interfaces">The interfaces.</param> /// <returns>The code.</returns> public override string GetClass(string className, MemberVisibilityLevel visibility, bool isStatic, IEnumerable<string> interfaces) { var sb = new StringBuilder(); sb.Append(GetVisibilityLevel(visibility)); if (isStatic) sb.Append(" static "); sb.Append(" class "); sb.Append(className); if (interfaces != null && !interfaces.IsEmpty()) { sb.Append(" : "); foreach (var i in interfaces) { sb.Append(i); sb.Append(ParameterSpacer); } sb.Length -= ParameterSpacer.Length; } return sb.ToString(); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <param name="isReadonly">If this field is readonly.</param> /// <param name="isStatic">If this field is static.</param> /// <returns>The code.</returns> public string GetField(string memberName, Type type, MemberVisibilityLevel visibility, string value, bool isReadonly, bool isStatic) { return GetField(memberName, GetTypeString(type), visibility, value, isReadonly, isStatic); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <param name="isReadonly">If this field is readonly.</param> /// <param name="isStatic">If this field is static.</param> /// <returns>The code.</returns> public string GetField(string memberName, Type type, MemberVisibilityLevel visibility, string value, bool isReadonly, bool isStatic) { return(GetField(memberName, GetTypeString(type), visibility, value, isReadonly, isStatic)); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <param name="isReadonly">If this field is readonly.</param> /// <param name="isStatic">If this field is static.</param> /// <returns>The code.</returns> public abstract string GetField(string memberName, string type, MemberVisibilityLevel visibility, string value, bool isReadonly, bool isStatic);
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public string GetField(string memberName, string type, MemberVisibilityLevel visibility) { return(GetField(memberName, type, visibility, string.Empty, false, false)); }
/// <summary> /// Gets the name and visibility to use for a method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> public virtual string GetMethodNameAndVisibility(string methodName, MemberVisibilityLevel visibility, Type returnType, bool isVirtual, bool isStatic) { return(GetMethodNameAndVisibility(methodName, visibility, GetTypeString(returnType), isVirtual, isStatic)); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="inputName">The name of the field (can be aliased).</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public string GetFieldName(string inputName, MemberVisibilityLevel visibility, Type type) { return(GetFieldName(inputName, visibility, GetTypeString(type))); }
/// <summary> /// Gets the code for a method header. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="parameters">The parameters.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> public string GetMethodHeader(string methodName, MemberVisibilityLevel visibility, MethodParameter[] parameters, Type returnType, bool isVirtual, bool isStatic) { return(GetMethodHeader(methodName, visibility, parameters, GetTypeString(returnType), isVirtual, isStatic)); }
/// <summary> /// Gets the code for a constant field. /// </summary> /// <param name="fieldName">Name of the field.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <returns>The code.</returns> public override string GetConstField(string fieldName, Type type, MemberVisibilityLevel visibility, string value) { var sb = new StringBuilder(); sb.Append(GetVisibilityLevel(visibility)); sb.Append(" const "); sb.Append(GetTypeString(type)); sb.Append(" "); sb.Append(fieldName); sb.Append(" = "); sb.Append(value); sb.Append(EndOfLine); return sb.ToString(); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <param name="isReadonly">If this field is readonly.</param> /// <param name="isStatic">If this field is static.</param> /// <returns>The code.</returns> public abstract string GetField(string memberName, string type, MemberVisibilityLevel visibility, string value, bool isReadonly, bool isStatic);
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="code">The code.</param> /// <param name="isReadonly">If this field is readonly.</param> /// <param name="isStatic">If this field is static.</param> /// <returns>The code.</returns> public override string GetField(string memberName, string type, MemberVisibilityLevel visibility, string code, bool isReadonly, bool isStatic) { var sb = new StringBuilder(); if (visibility != MemberVisibilityLevel.Private) { sb.Append(GetVisibilityLevel(visibility)); sb.Append(" "); } if (isStatic) sb.Append(" static "); if (isReadonly) sb.Append(" readonly "); sb.Append(type); sb.Append(" "); sb.Append(memberName); if (!string.IsNullOrEmpty(code)) { sb.Append(" = "); sb.Append(code); } sb.Append(EndOfLine); return sb.ToString(); }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="memberName">Name of the member.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public string GetField(string memberName, string type, MemberVisibilityLevel visibility) { return GetField(memberName, type, visibility, string.Empty, false, false); }
/// <summary> /// Gets the code for an interface. /// </summary> /// <param name="interfaceName">The interface name.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public override string GetInterface(string interfaceName, MemberVisibilityLevel visibility) { return GetVisibilityLevel(visibility) + " interface " + interfaceName; }
/// <summary> /// Gets the code for a field. /// </summary> /// <param name="inputName">The name of the field (can be aliased).</param> /// <param name="visibility">The visibility.</param> /// <param name="type">The type.</param> /// <returns>The code.</returns> public virtual string GetFieldName(string inputName, MemberVisibilityLevel visibility, string type) { if (ApplyAlias(ref inputName)) { if (visibility != MemberVisibilityLevel.Private) return inputName; } inputName = RemoveSeparatorCharacters(inputName); switch (visibility) { case MemberVisibilityLevel.Private: // Prefix _ and make the first character lowercase return "_" + inputName.Substring(0, 1).ToLower() + inputName.Substring(1); default: // Make first character uppercase return inputName.Substring(0, 1).ToUpper() + inputName.Substring(1); } }
/// <summary> /// Gets the code for an interface. /// </summary> /// <param name="interfaceName">The interface name.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public override string GetInterface(string interfaceName, MemberVisibilityLevel visibility) { return(GetVisibilityLevel(visibility) + " interface " + interfaceName); }
/// <summary> /// Gets the code for a method header. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="parameters">The parameters.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> public string GetMethodHeader(string methodName, MemberVisibilityLevel visibility, MethodParameter[] parameters, Type returnType, bool isVirtual, bool isStatic) { return GetMethodHeader(methodName, visibility, parameters, GetTypeString(returnType), isVirtual, isStatic); }
/// <summary> /// Gets the code for a class. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="visibility">The visibility.</param> /// <param name="isStatic">Whether or not it is a static class.</param> /// <param name="interfaces">The interfaces.</param> /// <returns>The code.</returns> public abstract string GetClass(string className, MemberVisibilityLevel visibility, bool isStatic, IEnumerable <string> interfaces);
/// <summary> /// Gets the name and visibility to use for a method. /// </summary> /// <param name="methodName">Name of the method.</param> /// <param name="visibility">The visibility.</param> /// <param name="returnType">Type of the return.</param> /// <param name="isVirtual">If this method will be virtual.</param> /// <param name="isStatic">If this method will be static.</param> /// <returns>The code.</returns> public virtual string GetMethodNameAndVisibility(string methodName, MemberVisibilityLevel visibility, Type returnType, bool isVirtual, bool isStatic) { return GetMethodNameAndVisibility(methodName, visibility, GetTypeString(returnType), isVirtual, isStatic); }
/// <summary> /// Gets the code for a class. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="visibility">The visibility.</param> /// <param name="isStatic">Whether or not it is a static class.</param> /// <param name="interfaces">The interfaces.</param> /// <returns>The code.</returns> public abstract string GetClass(string className, MemberVisibilityLevel visibility, bool isStatic, IEnumerable<string> interfaces);
/// <summary> /// Gets the code for a property. /// </summary> /// <param name="propertyName">Name of the property.</param> /// <param name="externalType">The external (exposed) type.</param> /// <param name="internalType">The internal (underlying) type.</param> /// <param name="getterVisibility">The getter visibility.</param> /// <param name="setterVisibility">The setter visibility.</param> /// <param name="member">The member.</param> /// <param name="isVirtual">If this property is virtual.</param> /// <param name="isStatic">If this property is static.</param> /// <returns>The code.</returns> public string GetProperty(string propertyName, Type externalType, Type internalType, MemberVisibilityLevel getterVisibility, MemberVisibilityLevel? setterVisibility, string member, bool isVirtual, bool isStatic) { return GetProperty(propertyName, GetTypeString(externalType), GetTypeString(internalType), getterVisibility, setterVisibility, member, isVirtual, isStatic); }
/// <summary> /// Gets the code for a constant field. /// </summary> /// <param name="fieldName">Name of the field.</param> /// <param name="type">The type.</param> /// <param name="visibility">The visibility.</param> /// <param name="value">The value.</param> /// <returns>The code.</returns> public abstract string GetConstField(string fieldName, Type type, MemberVisibilityLevel visibility, string value);
/// <summary> /// Gets the header for a constructor. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="visibility">The visibility.</param> /// <param name="parameters">The parameters.</param> /// <returns>The code.</returns> public virtual string GetConstructorHeader(string className, MemberVisibilityLevel visibility, MethodParameter[] parameters) { return(GetMethodHeader(className, visibility, parameters, string.Empty, false, false)); }
/// <summary> /// Gets the header for a constructor. /// </summary> /// <param name="className">Name of the class.</param> /// <param name="visibility">The visibility.</param> /// <param name="parameters">The parameters.</param> /// <returns>The code.</returns> public virtual string GetConstructorHeader(string className, MemberVisibilityLevel visibility, MethodParameter[] parameters) { return GetMethodHeader(className, visibility, parameters, string.Empty, false, false); }
/// <summary> /// Gets the code to represent a visibility level. /// </summary> /// <param name="visibility">The visibility level.</param> /// <returns>The code.</returns> /// <exception cref="ArgumentOutOfRangeException"><c>visibility</c> contains an undefined /// <see cref="MemberVisibilityLevel"/> value.</exception> public override string GetVisibilityLevel(MemberVisibilityLevel visibility) { switch (visibility) { case MemberVisibilityLevel.Private: return "private"; case MemberVisibilityLevel.Public: return "public"; case MemberVisibilityLevel.Internal: return "internal"; case MemberVisibilityLevel.Protected: return "protected"; case MemberVisibilityLevel.ProtectedInternal: return "protected internal"; default: throw new ArgumentOutOfRangeException("visibility"); } }
/// <summary> /// Gets the code for an interface. /// </summary> /// <param name="interfaceName">The interface name.</param> /// <param name="visibility">The visibility.</param> /// <returns>The code.</returns> public abstract string GetInterface(string interfaceName, MemberVisibilityLevel visibility);
/// <summary> /// Gets the code to represent a visibility level. /// </summary> /// <param name="visibility">The visibility level.</param> /// <returns>The code.</returns> public abstract string GetVisibilityLevel(MemberVisibilityLevel visibility);
/// <summary> /// Gets the code to represent a visibility level. /// </summary> /// <param name="visibility">The visibility level.</param> /// <returns>The code.</returns> public abstract string GetVisibilityLevel(MemberVisibilityLevel visibility);