MCPcopy Create free account
hub / github.com/christophhart/HISE / getIndexForEvent

Method getIndexForEvent

hi_scripting/scripting/api/ScriptingApiObjects.cpp:6582–6623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6580}
6581
6582int ScriptingObjects::ScriptUnorderedStack::getIndexForEvent(var value) const
6583{
6584 if (auto m = dynamic_cast<ScriptingMessageHolder*>(value.getObject()))
6585 {
6586 int numUsed = eventData.size();
6587
6588 if (compareFunctionType == CompareFunctions::Custom)
6589 {
6590 var args[2];
6591 args[0] = var(compareHolder.get());
6592 args[1] = value;
6593
6594 for (int i = 0; i < numUsed; i++)
6595 {
6596 compareHolder->setMessage(eventData[i]);
6597 var rv;
6598
6599 auto cf = const_cast<WeakCallbackHolder*>(&compareFunction);
6600
6601 auto r = cf->callSync(args, 2, &rv);
6602
6603 if (!r.wasOk())
6604 reportScriptError(r.getErrorMessage());
6605
6606 if ((bool)rv)
6607 return i;
6608 }
6609 }
6610 else
6611 {
6612 auto e1 = m->getMessageCopy();
6613
6614 for (int i = 0; i < numUsed; i++)
6615 {
6616 if (hcf(e1, eventData[i]))
6617 return i;
6618 }
6619 }
6620 }
6621
6622 return -1;
6623}
6624
6625
6626

Callers

nothing calls this directly

Calls 9

varFunction · 0.85
getMessageCopyMethod · 0.80
getObjectMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
setMessageMethod · 0.45
callSyncMethod · 0.45
wasOkMethod · 0.45
getErrorMessageMethod · 0.45

Tested by

no test coverage detected