void VirtualMemberFunctionTable::insertMemberFunction( MemberFunction* a_pMemberFunction )
{
    for(auto it = m_pMemberFunctions->begin(); it != m_pMemberFunctions->end(); ++it)
    {
        if(*it)
        {
            if(a_pMemberFunction->canOverride(*it))
            {
                a_pMemberFunction->setVirtual(); // Set virtual if not (indeed, even if not explicitely virtual, a member function which overrides a virtual becomes virtual 
                *it = a_pMemberFunction; // replace base class member function by this one (overrides entry)
                return;
            }
        }
    }
    // We did not find any overrides 
    if(getOffset() == 0 // and it's the main vtable 
        AND a_pMemberFunction->isVirtual()) // and the member function is virtual 
    {
        // => insert it 
        size_t uiIndex = a_pMemberFunction->getVirtualTableIndex();
        if(uiIndex == ~size_t(0))
        {
            // to a new index
            addMemberFunction(a_pMemberFunction);
        }
        else 
        {
            // to an index given by the function itself
            setMemberFunction(uiIndex, a_pMemberFunction);
        }
    }
}
ScShiftFloatArrayProperty::ScShiftFloatArrayProperty(QScriptEngine *eng, const QString &parent) : ScShiftProperty(eng, parent)
  {
  addMemberFunction("add", add);
  addMemberFunction("at", at);
  }
예제 #3
0
		ClassMetatable& addMember(const char* name, Ret class_type::* f)
		{
			return addMemberFunction(name, f);
		}
예제 #4
0
		ClassMetatable& addMember(const char* name, Fun f)
		{
			return addMemberFunction(name, f);
		}
예제 #5
0
ScShiftDatabase::ScShiftDatabase(QScriptEngine *eng) : ScShiftEntity(eng, "SEntity")
  {
  addMemberFunction("addType", addType);
  }
예제 #6
0
		KAGUYA_DEPRECATED_FEATURE("ClassMetatable is deprecated. use UserdataMetatable instead.") ClassMetatable& addMember(const char* name, Ret class_type::* f)
		{
			return addMemberFunction(name, f);
		}