Skip to content

Commit

Permalink
Adding descriptions for ToText methods
Browse files Browse the repository at this point in the history
  • Loading branch information
adecler committed Oct 20, 2022
1 parent ac38c93 commit 9e76399
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions BHoM_Engine/Convert/ToText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public static partial class Convert
/**** Interface Methods ****/
/***************************************************/

[Description("Provides a human-friendly text representation of the provided object.")]
[Input("member", "object to convert to text.")]
[Input("includePath", "If true, the path/namespace will be provided.")]
[Output("Text representation.")]
public static string IToText(this object member, bool includePath = false)
{
if (member == null)
Expand All @@ -50,6 +54,10 @@ public static string IToText(this object member, bool includePath = false)
/**** Public Methods ****/
/***************************************************/

[Description("Provides a human-friendly text representation of a member of a class.")]
[Input("member", "member to convert to text.")]
[Input("includePath", "If true, the path/namespace will be provided.")]
[Output("Text representation.")]
public static string ToText(this MemberInfo member, bool includePath = false)
{
if (member == null)
Expand All @@ -65,6 +73,18 @@ public static string ToText(this MemberInfo member, bool includePath = false)

/***************************************************/

[Description("Provides a human-friendly text representation of a method.")]
[Input("method", "method to convert to text.")]
[Input("includePath", "If true, the path/namespace will be provided.")]
[Input("paramStart", "Start symbol used for the beginning of the method parameters. Usually, '('.")]
[Input("paramSeparator", "Symbol used to separate the parameters. Usually, ','.")]
[Input("paramEnd", "Start symbol used for the end of the method parameters. Usually, ')'.")]
[Input("removeIForInterface", "If true, the 'I' in front of the interface method will not show.")]
[Input("includeParamNames", "If true, the name of the parameters will be written. Otherwise, only their types will show.")]
[Input("maxParams", "Maximum number of parameter to write. Any remaining will be represented with '...'.")]
[Input("maxChars", "Maximum number of characters to use. Any remaining will be represented with '...'.")]
[Input("includeParamPaths", "If true, the path/namespace will be provided.")]
[Output("Text representation.")]
public static string ToText(this MethodBase method, bool includePath = false, string paramStart = "(", string paramSeparator = ", ", string paramEnd = ")", bool removeIForInterface = true, bool includeParamNames = true, int maxParams = 5, int maxChars = 40, bool includeParamPaths = false)
{
if (method == null)
Expand Down Expand Up @@ -124,6 +144,13 @@ public static string ToText(this MethodBase method, bool includePath = false, st

/***************************************************/

[Description("Provides a human-friendly text representation of a type.")]
[Input("type", "type to convert to text.")]
[Input("includePath", "If true, the path/namespace will be provided.")]
[Input("genericStart", "Start symbol used for the beginning of the generic parameters, if any. Usually, '<'.")]
[Input("genericSeparator", "Symbol used to separate the generic parameters. Usually, ','.")]
[Input("genericEnd", "Start symbol used for the end of the generic parameters, if any. Usually, '>'.")]
[Output("Text representation.")]
public static string ToText(this Type type, bool includePath = false, bool replaceGeneric = false, string genericStart = "<", string genericSeparator = ", ", string genericEnd = ">")
{
if (type == null)
Expand Down Expand Up @@ -161,6 +188,10 @@ public static string ToText(this Type type, bool includePath = false, bool repla

/***************************************************/

[Description("Provides a human-friendly text representation of an enum.")]
[Input("item", "enum to convert to text.")]
[Input("includePath", "If true, the path/namespace will be provided.")]
[Output("Text representation.")]
public static string ToText(this Enum item, bool includePath = false)
{
if (item == null)
Expand Down

0 comments on commit 9e76399

Please sign in to comment.