aboutsummaryrefslogtreecommitdiff
path: root/system/include
diff options
context:
space:
mode:
Diffstat (limited to 'system/include')
-rwxr-xr-xsystem/include/emscripten/bind.h50
1 files changed, 27 insertions, 23 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index fd949234..f4fe37af 100755
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -579,22 +579,18 @@ namespace emscripten {
////////////////////////////////////////////////////////////////////////////////
template<typename PointerType>
- class smart_ptr {
- public:
- smart_ptr(const char* name) {
- using namespace internal;
- typedef typename PointerType::element_type PointeeType;
-
- registerStandardTypes();
- _embind_register_smart_ptr(
- TypeID<PointerType>::get(),
- TypeID<PointeeType>::get(),
- name,
- reinterpret_cast<GenericFunction>(&raw_smart_pointer_constructor<PointeeType*>),
- reinterpret_cast<GenericFunction>(&raw_destructor<PointerType>),
- reinterpret_cast<GenericFunction>(&get_pointee<PointerType>));
-
- }
+ void smart_ptr(const char* name) {
+ using namespace internal;
+ typedef typename PointerType::element_type PointeeType;
+
+ registerStandardTypes();
+ _embind_register_smart_ptr(
+ TypeID<PointerType>::get(),
+ TypeID<PointeeType>::get(),
+ name,
+ reinterpret_cast<GenericFunction>(&raw_smart_pointer_constructor<PointeeType*>),
+ reinterpret_cast<GenericFunction>(&raw_destructor<PointerType>),
+ reinterpret_cast<GenericFunction>(&get_pointee<PointerType>));
};
////////////////////////////////////////////////////////////////////////////////
@@ -630,13 +626,6 @@ namespace emscripten {
}
};
- /*
- void assertInitialized() {
- if (!jsobj) {
- internal::_embind_fatal_error(
- "Cannot invoke call on uninitialized Javascript interface wrapper.", "JSInterface");
- }
- }*/
val wrapped;
};
@@ -673,6 +662,21 @@ namespace emscripten {
return *this;
}
+ template<typename SmartPtr, typename... Args>
+ class_& constructor(SmartPtr (*factory)(Args...)) {
+ using namespace internal;
+
+ smart_ptr<SmartPtr>("SmartPtr");
+
+ typename WithPolicies<>::template ArgTypeList<void, ConstructorArgs...> args;
+ _embind_register_class_smart_ptr_constructor(
+ TypeID<ClassType>::get(),
+ args.count,
+ args.types,
+ reinterpret_cast<GenericFunction>(&raw_smart_ptr_constructor
+ return *this;
+ }
+
template<typename WrapperType>
class_& allow_subclass() {
using namespace internal;