aboutsummaryrefslogtreecommitdiff
path: root/system/lib/embind
diff options
context:
space:
mode:
authorBill Welden <bwelden@imvu.com>2013-01-16 14:19:19 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:23:11 +0300
commit6c56bdda8d4f9ab4eb31e86ce71488106b061a33 (patch)
tree913199efbddfd2fb30d86f09d2b0d20b3235f9b4 /system/lib/embind
parentd893eed16b2257c3ffbb186c08d45a053cc5de68 (diff)
It is now possible to access base class properties and methods from a derived class (multiple inheritance not yet supported).
Diffstat (limited to 'system/lib/embind')
-rwxr-xr-xsystem/lib/embind/bind.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/system/lib/embind/bind.cpp b/system/lib/embind/bind.cpp
index a4b67fa5..5e82bb7e 100755
--- a/system/lib/embind/bind.cpp
+++ b/system/lib/embind/bind.cpp
@@ -10,7 +10,7 @@
using namespace emscripten;
namespace __cxxabiv1 {
- std::vector<const __class_type_info*> __getBaseClasses(const __class_type_info* cti) {
+ std::vector<const __class_type_info*> __internalGetBaseClasses(const __class_type_info* cti) {
std::vector<const __class_type_info*> bases;
const __si_class_type_info* scti = dynamic_cast<const __si_class_type_info*>(cti);
@@ -48,7 +48,7 @@ namespace __cxxabiv1 {
if (dv == bs) {
paths.emplace_back(newPath);
} else {
- std::vector<const __class_type_info*> bases = __getBaseClasses(dv);
+ std::vector<const __class_type_info*> bases = __internalGetBaseClasses(dv);
for (int i = 0; i < bases.size(); i++) {
__getDerivationPaths(bases[i], bs, newPath, paths);
}
@@ -212,6 +212,15 @@ namespace emscripten {
return name;
}
+ std::vector<int> __getBaseClasses(int tp) {
+ std::vector<const __cxxabiv1::__class_type_info*> baseTypes = __internalGetBaseClasses((const __cxxabiv1::__class_type_info*)tp);
+ std::vector<int> bases;
+ for (int j = 0; j < baseTypes.size(); j++) {
+ bases.emplace_back((int)baseTypes[j]);
+ }
+ return bases;
+ }
+
int EMSCRIPTEN_KEEPALIVE __peek32(int p) {
return *(int *)p;
}
@@ -221,6 +230,7 @@ namespace emscripten {
// conversion for the return value. This has the unfortunate side-effect of exposing it to third party
// developers, but perhaps the double underscore will scare them away from calling it.
function("__getDerivationPath", &__getDerivationPath);
+ function("__getBaseClasses", &__getBaseClasses);
function("__peek32", &__peek32);
}));
}