diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-04 18:44:33 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2017-12-04 18:44:33 +0200 |
| commit | 3689238cb9ca77cbd7fa34dbd15003af87266e36 (patch) | |
| tree | 3d928df9c9b0b11703e6fb10ddf09a436a405dde /Software/Visual_Studio/Tango.CodeGeneration/Method.cs | |
| parent | 6c3f942b4e321dc9e7bbca8d95dc81dcb43f7fd2 (diff) | |
| download | Tango-3689238cb9ca77cbd7fa34dbd15003af87266e36.tar.gz Tango-3689238cb9ca77cbd7fa34dbd15003af87266e36.zip | |
Added Code Generation Library.
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration/Method.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.CodeGeneration/Method.cs | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Method.cs b/Software/Visual_Studio/Tango.CodeGeneration/Method.cs new file mode 100644 index 000000000..5c460e4dc --- /dev/null +++ b/Software/Visual_Studio/Tango.CodeGeneration/Method.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.CodeGeneration +{ + /// <summary> + /// Represents a method code object. + /// </summary> + /// <seealso cref="Tango.CodeGeneration.CodeObject" /> + public class Method : CodeObject + { + /// <summary> + /// Gets or sets the method name. + /// </summary> + public String Name { get; set; } + + /// <summary> + /// Gets or sets the method arguments. + /// </summary> + public List<KeyValuePair<String, String>> Arguments { get; set; } + + /// <summary> + /// Gets or sets the method return type. + /// </summary> + public String ReturnType { get; set; } + + /// <summary> + /// Gets or sets the method modifier. + /// </summary> + public MethodModifier MethodModifier { get; set; } + + /// <summary> + /// Gets or sets the method content. + /// </summary> + public String Content { get; set; } + + /// <summary> + /// Initializes a new instance of the <see cref="Method"/> class. + /// </summary> + public Method() + : base() + { + Name = "MyMethod"; + Arguments = new List<KeyValuePair<string, string>>(); + ReturnType = "void"; + } + + /// <summary> + /// Initializes a new instance of the <see cref="Method"/> class. + /// </summary> + /// <param name="name">The name.</param> + /// <param name="returnType">Type of the return.</param> + /// <param name="content">The content.</param> + /// <param name="methodModifier">The method modifier.</param> + public Method(String name, String returnType, String content, MethodModifier methodModifier = Tango.CodeGeneration.MethodModifier.None) + : this() + { + Name = name; + ReturnType = returnType; + Content = content; + MethodModifier = methodModifier; + } + + /// <summary> + /// Gets the arguments string. + /// </summary> + /// <returns></returns> + public String GetArgumentsString() + { + if (Arguments.Count > 0) + { + return String.Join(", ", Arguments.Select(x => x.Key + " " + x.Value).ToList()); + } + else + { + return String.Empty; + } + } + } +} |
