MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / add_base_class

Method add_base_class

ogsr_engine/Luabind/src/class_rep.cpp:672–739  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

670}
671
672void luabind::detail::class_rep::add_base_class(const luabind::detail::class_rep::base_info& binfo)
673{
674 // If you hit this assert you are deriving from a type that is not registered
675 // in lua. That is, in the class_<> you are giving a baseclass that isn't registered.
676 // Please note that if you don't need to have access to the base class or the
677 // conversion from the derived class to the base class, you don't need
678 // to tell luabind that it derives.
679 assert(binfo.base && "You cannot derive from an unregistered type");
680
681 class_rep* bcrep = binfo.base;
682
683 // import all functions from the base
684 typedef list_class<detail::method_rep> methods_t;
685
686 for (methods_t::const_iterator i = bcrep->m_methods.begin();
687 i != bcrep->m_methods.end(); ++i)
688 {
689 auto copy = *i;
690 add_method(std::move(copy));
691 }
692
693 // import all getters from the base
694 for (map_class<const char*, callback, ltstr>::const_iterator i = bcrep->m_getters.begin();
695 i != bcrep->m_getters.end(); ++i)
696 {
697 callback& m = m_getters[i->first];
698 m.pointer_offset = i->second.pointer_offset + binfo.pointer_offset;
699 m.func = i->second.func;
700
701#ifndef LUABIND_NO_ERROR_CHECKING
702 m.match = i->second.match;
703 m.sig = i->second.sig;
704#endif
705 }
706
707 // import all setters from the base
708 for (map_class<const char*, callback, ltstr>::const_iterator i = bcrep->m_setters.begin();
709 i != bcrep->m_setters.end(); ++i)
710 {
711 callback& m = m_setters[i->first];
712 m.pointer_offset = i->second.pointer_offset + binfo.pointer_offset;
713 m.func = i->second.func;
714
715#ifndef LUABIND_NO_ERROR_CHECKING
716 m.match = i->second.match;
717 m.sig = i->second.sig;
718#endif
719 }
720
721 // import all static constants
722 for (map_class<const char*, int, ltstr>::const_iterator i = bcrep->m_static_constants.begin();
723 i != bcrep->m_static_constants.end(); ++i)
724 {
725 int& v = m_static_constants[i->first];
726 v = i->second;
727 }
728
729 // import all operators

Callers 2

register_Method · 0.80
stage2Method · 0.80

Calls 3

beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected