diff Resources/CodeGeneration/template.in.ts @ 490:6470248790db bgo-commands-codegen

ongoing codegen work
author bgo-osimis
date Mon, 18 Feb 2019 15:38:05 +0100
parents
children 8e7e151ef472
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CodeGeneration/template.in.ts	Mon Feb 18 15:38:05 2019 +0100
@@ -0,0 +1,38 @@
+class Greeter {
+    greeting: string;
+    constructor(message: string) {
+        this.greeting = message;
+    }
+    greet() {
+        return "Hello, " + this.greeting;
+    }
+}
+enum Color { Red, Green, Blue };
+
+class TestMessage {
+    s1: string;
+    s2: Array<string>;
+    s3: Array<Array<string>>;
+    s4: Map<string, number>;
+    s5: Map<number, Array<string>>;
+    s6: Color;
+    s7: boolean;
+}
+
+let tm = new TestMessage();
+tm.s2 = new Array<string>()
+tm.s2.push("toto");
+tm.s2.push("toto2");
+tm.s2.push("toto3");
+tm.s4 = new Map<string, number>();
+tm.s4["toto"] = 42;
+tm.s4["toto"] = 1999;
+tm.s4["tatata"] = 1999;
+tm.s6 = Color.Red;
+tm.s7 = true
+
+let txt = JSON.stringify(tm)
+console.log(txt);
+
+let greeter = new Greeter("world");
+