aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/Templates
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2017-12-04 18:44:33 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2017-12-04 18:44:33 +0200
commit3689238cb9ca77cbd7fa34dbd15003af87266e36 (patch)
tree3d928df9c9b0b11703e6fb10ddf09a436a405dde /Software/Visual_Studio/Tango.CodeGeneration/Templates
parent6c3f942b4e321dc9e7bbca8d95dc81dcb43f7fd2 (diff)
downloadTango-3689238cb9ca77cbd7fa34dbd15003af87266e36.tar.gz
Tango-3689238cb9ca77cbd7fa34dbd15003af87266e36.zip
Added Code Generation Library.
Diffstat (limited to 'Software/Visual_Studio/Tango.CodeGeneration/Templates')
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/Class.cshtml18
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/CodeFile.cshtml11
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/DpProperty.cshtml8
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/Method.cshtml4
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/Namespace.cshtml7
-rw-r--r--Software/Visual_Studio/Tango.CodeGeneration/Templates/Property.cshtml41
6 files changed, 89 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/Class.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Class.cshtml
new file mode 100644
index 000000000..693fe9136
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Class.cshtml
@@ -0,0 +1,18 @@
+ @(Model.GetAttributesString())
+ @(Model.GetModifierString()) class @(Model.Name) @(Model.InheritsFrom.Count > 0 ? " : " + String.Join(", ",Model.InheritsFrom) : null)
+ {
+ @foreach (var prop in Model.Properties)
+ {
+ <div>@prop.GenerateCode()</div>
+ }
+
+ @foreach (var dp in Model.DependencyProperties)
+ {
+ <div>@dp.GenerateCode()</div>
+ }
+
+ @foreach (var method in Model.Methods)
+ {
+ <div>@method.GenerateCode()</div>
+ }
+ } \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/CodeFile.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/CodeFile.cshtml
new file mode 100644
index 000000000..404a2d58e
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/CodeFile.cshtml
@@ -0,0 +1,11 @@
+@foreach (var u in Model.Usings)
+{
+ <div>using @(u);</div>
+}
+
+@foreach (var ns in Model.Namespaces)
+{
+ <div>@ns.GenerateCode()</div>
+
+
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/DpProperty.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/DpProperty.cshtml
new file mode 100644
index 000000000..aa0b57864
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/DpProperty.cshtml
@@ -0,0 +1,8 @@
+ @(Model.GetAttributesString())
+ public @(Model.Type) @(Model.Name)
+ {
+ get { return (@(Model.Type))GetValue(@(Model.Name)Property); }
+ set { SetValue(@(Model.Name)Property, value); }
+ }
+ public static readonly DependencyProperty @(Model.Name)Property =
+ DependencyProperty.Register("@(Model.Name)", typeof(@(Model.Type)), typeof(@(Model.OwnerClass)), new PropertyMetadata(@(Model.DefaultValue) @(Model.PropertyChangedCallback != null ? ", " + Model.PropertyChangedCallback : ""))); \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/Method.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Method.cshtml
new file mode 100644
index 000000000..3b54d4e57
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Method.cshtml
@@ -0,0 +1,4 @@
+@(Model.GetModifierString()) @(Model.MethodModifier != CodeGenerator.MethodModifier.None ? Model.MethodModifier.ToString().ToLower() : null) @(Model.ReturnType) @(Model.Name)(@(Model.GetArgumentsString()))
+ {
+ @Model.Content
+ } \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/Namespace.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Namespace.cshtml
new file mode 100644
index 000000000..05fd682c4
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Namespace.cshtml
@@ -0,0 +1,7 @@
+ namespace @(Model.Name)
+ {
+ @foreach (var cls in Model.Classes)
+ {
+ <div>@cls.GenerateCode()</div>
+ }
+ } \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.CodeGeneration/Templates/Property.cshtml b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Property.cshtml
new file mode 100644
index 000000000..f1dc61696
--- /dev/null
+++ b/Software/Visual_Studio/Tango.CodeGeneration/Templates/Property.cshtml
@@ -0,0 +1,41 @@
+@if (Model.SetterContent == null && Model.GetterContent == null)
+{
+ <div>
+ @(Model.GetAttributesString())
+ @(Model.GetModifierString()) @(Model.Type) @(Model.Name) { get; set; }
+ </div>
+}
+else if (Model.SetterContent != null && Model.GetterContent != null)
+{
+ <div>
+ private @(Model.Type) @(Model.GetPrivateField());
+
+ @(Model.GetAttributesString())
+ @(Model.GetModifierString()) @(Model.Type) @(Model.Name)
+ {
+ get
+ {
+ @(Model.GetterContent)
+ }
+ @(Model.SetterModifier != CodeGenerator.CodeObjectModifier.None ? Model.SetterModifier.ToString().ToLower() : "") set
+ {
+ @(Model.SetterContent)
+ }
+ }
+ </div>
+}
+else if (Model.GetterContent != null)
+{
+ <div>
+ private @(Model.Type) @(Model.GetPrivateField());
+
+ @(Model.GetAttributesString())
+ @(Model.GetModifierString()) @(Model.Type) @(Model.Name)
+ {
+ get
+ {
+ @(Model.GetterContent)
+ }
+ }
+ </div>
+} \ No newline at end of file