aboutsummaryrefslogtreecommitdiff
path: root/system/include
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-03-18 16:33:44 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:26:03 +0300
commitbb23c470f034601b70136a3eb56f829e84674bc4 (patch)
tree814bec466634b31b2530abcb8aed0ff20440998f /system/include
parenta09b543bf434b0f5e27b776f7a5a752f3e1c317d (diff)
Give each class a typeid function
Diffstat (limited to 'system/include')
-rwxr-xr-xsystem/include/emscripten/bind.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index e5865971..cd208d37 100755
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -114,6 +114,7 @@ namespace emscripten {
TYPEID pointerType,
TYPEID constPointerType,
TYPEID baseClassType,
+ GenericFunction getActualType,
GenericFunction upcast,
GenericFunction downcast,
bool isPolymorphic,
@@ -648,6 +649,11 @@ namespace emscripten {
return nullptr;
}
};
+
+ template<typename T>
+ inline TYPEID getActualType(T* ptr) {
+ return reinterpret_cast<TYPEID>(&typeid(ptr));
+ };
}
template<typename BaseClass>
@@ -692,7 +698,7 @@ namespace emscripten {
template<typename T>
struct is_ptr<ptr<T>> {
enum { value = true };
- };
+ };
};
template<typename ClassType, typename BaseSpecifier = internal::NoBaseClass>
@@ -711,9 +717,10 @@ namespace emscripten {
TypeID<AllowedRawPointer<ClassType>>::get(),
TypeID<AllowedRawPointer<const ClassType>>::get(),
BaseSpecifier::get(),
+ reinterpret_cast<GenericFunction>(&getActualType<ClassType>),
BaseSpecifier::template getUpcaster<ClassType>(),
BaseSpecifier::template getDowncaster<ClassType>(),
- std::is_polymorphic<ClassType>::value,
+ std::is_polymorphic<ClassType>::value, // TODO: may not be necessary
name,
reinterpret_cast<GenericFunction>(&raw_destructor<ClassType>));
}