1. embind class
2020-07-14 06:54
816 查看
1 #include <emscripten/bind.h> 2 #include <string> 3 4 using namespace std; 5 using namespace emscripten; 6 7 class xClass { 8 public: 9 // 构造方法;10 xClass (int x, string y): x(x), y(y) {}11 12 // 成员函数;13 void incrementX () {14 x += 1;15 }16 17 // [GETTER]18 int getValueX () const {19 return x;20 } 21 // [SETTER]22 void setValueX (int val) {23 x = val;24 }25 26 // 静态方法;27 static string getStringValue (const xClass& instance) {28 return instance.y;29 }30 31 private:32 int x;33 string y;34 };35 36 EMSCRIPTEN_BINDINGS(module) {37 class_<xClass>("xClass")38 .constructor<int, string>()39 .function("incrementX", &xClass::incrementX)40 .property("x", &xClass::getValueX, &xClass::setValueX)41 .class_function("getStringValue", &xClass::getStringValue);42 }
1. embind class
相关文章推荐
- com.ibatis.common.beans.ProbeException: There is no READABLE property named 'value' in class 'com.ving.xzfw.vo.PaymentInfo'
- 无法嵌入互操作类型“Microsoft.Office.Interop.Excel.ApplicationClass”。请改用适用的接口
- Tomcat配置: The archive: /bin/bootstrap.jar which is referenced by the classpath, does not exist.
- What is a java ClassLoader?
- Phonegap解决错误:Error initializing Cordova:Class not found
- Java Class类以及获取Class实例的三种方式
- Mastering Python-Packt Publishing 2016(读书笔记)第1版(讲解3.5的coroutine、asyncio、metaclass等)
- 第02天实战技术(05):super,superClass,class
- Spring加载xml文件错误异常:Offending resource: class path resource [spring-context.xml];
- python的class之二
- Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
- 在QTP中如何使用Class(类)
- class Student < Person
- [show] java.lang.IncompatibleClassChangeError:Implementing class
- 深刻理解Python中的元类(metaclass)
- dojo/dom-class源码学习
- Cocos Creator 使用 cc.Class 声明类型(摘自官方文档)
- 【完美解决系列】duplicate definition of library class [android.net.http.SslError]
- Java ClassLoad详解
- 小白H5成长之路6:CSS样式的另一种写法,class是个好东西