MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / class_

Class class_

system/include/emscripten/bind.h:1460–1828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1458
1459template<typename ClassType, typename BaseSpecifier = internal::NoBaseClass>
1460class class_ {
1461public:
1462 typedef ClassType class_type;
1463 typedef BaseSpecifier base_specifier;
1464
1465 class_() = delete;
1466
1467 EMSCRIPTEN_ALWAYS_INLINE explicit class_(const char* name) {
1468 using namespace internal;
1469
1470 BaseSpecifier::template verify<ClassType>();
1471
1472 auto _getActualType = &getActualType<ClassType>;
1473 auto upcast = BaseSpecifier::template getUpcaster<ClassType>();
1474 auto downcast = BaseSpecifier::template getDowncaster<ClassType>();
1475 auto destructor = &raw_destructor<ClassType>;
1476
1477 _embind_register_class(
1478 TypeID<ClassType>::get(),
1479 TypeID<AllowedRawPointer<ClassType>>::get(),
1480 TypeID<AllowedRawPointer<const ClassType>>::get(),
1481 BaseSpecifier::get(),
1482 getSignature(_getActualType),
1483 reinterpret_cast<GenericFunction>(_getActualType),
1484 getSignature(upcast),
1485 reinterpret_cast<GenericFunction>(upcast),
1486 getSignature(downcast),
1487 reinterpret_cast<GenericFunction>(downcast),
1488 name,
1489 getSignature(destructor),
1490 reinterpret_cast<GenericFunction>(destructor));
1491 }
1492
1493 template<typename PointerType>
1494 EMSCRIPTEN_ALWAYS_INLINE const class_& smart_ptr(const char* name) const {
1495 using namespace internal;
1496
1497 typedef smart_ptr_trait<PointerType> PointerTrait;
1498 typedef typename PointerTrait::element_type PointeeType;
1499
1500 static_assert(std::is_same<ClassType, typename std::remove_cv<PointeeType>::type>::value, "smart pointer must point to this class");
1501
1502 auto get = &PointerTrait::get;
1503 auto construct_null = &PointerTrait::construct_null;
1504 auto share = &PointerTrait::share;
1505 auto destructor = &raw_destructor<PointerType>;
1506
1507 _embind_register_smart_ptr(
1508 TypeID<PointerType>::get(),
1509 TypeID<PointeeType>::get(),
1510 name,
1511 PointerTrait::get_sharing_policy(),
1512 getSignature(get),
1513 reinterpret_cast<GenericFunction>(get),
1514 getSignature(construct_null),
1515 reinterpret_cast<GenericFunction>(construct_null),
1516 getSignature(share),
1517 reinterpret_cast<GenericFunction>(share),

Callers

nothing calls this directly

Calls 9

getSignatureFunction · 0.85
getContextFunction · 0.85
getCountMethod · 0.80
getTypesMethod · 0.80
constructorClass · 0.70
getFunction · 0.50
typeFunction · 0.50
functionMethod · 0.45

Tested by

no test coverage detected