• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  "Aki class": {
3    "prefix": "akiclass",
4    "body": [
5      "class A {",
6      "  public:",
7      "      A() {",
8      "          value_ = -1;",
9      "          result = -1;",
10      "      };",
11      "      explicit A(double test) { value_ = test; }",
12      "      ~A() = default;",
13      "      static double MultiplyObject(A obj1, A obj2) { return obj1.value_ * obj2.value_; }",
14      "      double Multiply(double mult) {",
15      "          value_ *= mult;",
16      "          return value_;",
17      "      }",
18      "      double GetValue() const { return value_; }",
19      "      void SetValue(double value) { value_ = value; }",
20      "      double result;",
21      "  private:",
22      "      double value_;",
23      "}; // A",
24      "// Bind class A.",
25      "JSBIND_CLASS(A) {",
26      "    // Bind default constructor of class.",
27      "    JSBIND_CONSTRUCTOR<>();",
28      "    // Bind a parameterized constructor of class.",
29      "    JSBIND_CONSTRUCTOR<double>();",
30      "    // Bind member method of class.",
31      "    JSBIND_METHOD(MultiplyObject);",
32      "    JSBIND_METHOD(Multiply);",
33      "    // Listen to class member properties in C++.",
34      "    JSBIND_FIELD(\"value\", GetValue, SetValue);",
35      "    // Bind member property of class.",
36      "    JSBIND_PROPERTY(result);",
37      "}"
38    ]
39  }
40}