MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / PostLoad

Method PostLoad

lib/utils/temp-variable.cpp:381–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381void TempVariableRef::PostLoad(int idx, SegmentType type,
382 const std::weak_ptr<Macro> &weakMacro)
383{
384 auto childMacro = weakMacro.lock();
385 if (!childMacro) {
386 return;
387 }
388
389 auto macro = childMacro.get();
390 for (int i = 0; i < _depth; i++) {
391 macro = getParentMacro(macro);
392 }
393
394 if (!macro) {
395 return;
396 }
397
398 std::deque<std::shared_ptr<MacroSegment>> segments;
399 switch (type) {
400 case SegmentType::NONE:
401 _segment.reset();
402 return;
403 case SegmentType::CONDITION:
404 segments = {macro->Conditions().begin(),
405 macro->Conditions().end()};
406 break;
407 case SegmentType::ACTION:
408 segments = {macro->Actions().begin(), macro->Actions().end()};
409 break;
410 case SegmentType::ELSEACTION:
411 segments = {macro->ElseActions().begin(),
412 macro->ElseActions().end()};
413 break;
414 default:
415 break;
416 }
417 if (idx < 0 || idx >= (int)segments.size()) {
418 _segment.reset();
419 return;
420 }
421 _segment = segments[idx];
422}
423
424std::optional<const TempVariable>
425TempVariableRef::GetTempVariable(Macro *macro) const

Callers 1

LoadMethod · 0.95

Calls 6

getParentMacroFunction · 0.85
sizeMethod · 0.80
getMethod · 0.45
resetMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected