From 3689238cb9ca77cbd7fa34dbd15003af87266e36 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 4 Dec 2017 18:44:33 +0200 Subject: Added Code Generation Library. --- .../Visual_Studio/Tango.CodeGeneration/Method.cs | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Software/Visual_Studio/Tango.CodeGeneration/Method.cs (limited to 'Software/Visual_Studio/Tango.CodeGeneration/Method.cs') 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 +{ + /// + /// Represents a method code object. + /// + /// + public class Method : CodeObject + { + /// + /// Gets or sets the method name. + /// + public String Name { get; set; } + + /// + /// Gets or sets the method arguments. + /// + public List> Arguments { get; set; } + + /// + /// Gets or sets the method return type. + /// + public String ReturnType { get; set; } + + /// + /// Gets or sets the method modifier. + /// + public MethodModifier MethodModifier { get; set; } + + /// + /// Gets or sets the method content. + /// + public String Content { get; set; } + + /// + /// Initializes a new instance of the class. + /// + public Method() + : base() + { + Name = "MyMethod"; + Arguments = new List>(); + ReturnType = "void"; + } + + /// + /// Initializes a new instance of the class. + /// + /// The name. + /// Type of the return. + /// The content. + /// The method modifier. + public Method(String name, String returnType, String content, MethodModifier methodModifier = Tango.CodeGeneration.MethodModifier.None) + : this() + { + Name = name; + ReturnType = returnType; + Content = content; + MethodModifier = methodModifier; + } + + /// + /// Gets the arguments string. + /// + /// + public String GetArgumentsString() + { + if (Arguments.Count > 0) + { + return String.Join(", ", Arguments.Select(x => x.Key + " " + x.Value).ToList()); + } + else + { + return String.Empty; + } + } + } +} -- cgit v1.3.1