MCPcopy Create free account
hub / github.com/XRay3D/GERBER_X3 / parseStepRepeat

Method parseStepRepeat

file_plugins/gerber/gbrparser.cpp:743–777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741}
742
743bool Parser::parseStepRepeat(const QString& gLine)
744{
745 /*
746 * <SR open> = %SRX<Repeats>Y<Repeats>I<Step>J<Step>*%
747 * <SR close> = %SR*%
748 * <SR statement> = <SR open>{<single command>|<region statement>}<SR close>
749 */
750 auto data { toU16StrView(gLine) };
751 static constexpr ctll::fixed_string ptrnStepRepeat(R"(^%SRX(\d+)Y(\d+)I(.\d*\.?\d*)J(.\d*\.?\d*)\*%$)"); // fixed_string("^%SRX(\d+)Y(\d+)I(.\d*\.?\d*)J(.\d*\.?\d*)\*%$");
752 if (auto [whole, srx, sry, sri, srj] = ctre::match<ptrnStepRepeat>(data); whole) {
753 if (m_abSrIdStack.top().workingType == WorkingType::StepRepeat)
754 closeStepRepeat();
755 m_stepRepeat.reset();
756 m_stepRepeat.x = CtreCapTo(srx);
757 m_stepRepeat.y = CtreCapTo(sry);
758 m_stepRepeat.i = CtreCapTo(sri), m_stepRepeat.i *= uScale;
759 m_stepRepeat.j = CtreCapTo(srj), m_stepRepeat.j *= uScale;
760 if (m_state.format()->unitMode == Inches) {
761 m_stepRepeat.i *= 25.4;
762 m_stepRepeat.j *= 25.4;
763 }
764 if (m_stepRepeat.x > 1 || m_stepRepeat.y > 1)
765 m_abSrIdStack.push({ WorkingType::StepRepeat, 0 });
766 return true;
767 }
768
769 static constexpr ctll::fixed_string ptrnStepRepeatEnd(R"(^%SR\*%$)"); // fixed_string("^%SR\*%$");
770 if (ctre::match<ptrnStepRepeatEnd>(data)) {
771 if (m_abSrIdStack.top().workingType == WorkingType::StepRepeat)
772 closeStepRepeat();
773 return true;
774 }
775
776 return false;
777}
778
779void Parser::closeStepRepeat()
780{

Callers

nothing calls this directly

Calls 5

toU16StrViewFunction · 0.85
CtreCapToClass · 0.85
pushMethod · 0.80
resetMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected