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

Method parseComment

file_plugins/excellon/exparser.cpp:100–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100bool Parser::parseComment(const QString& line)
101{
102 if (line.startsWith(';')) {
103 qDebug() << "line" << line;
104 auto data { toU16StrView(line) };
105 static constexpr ctll::fixed_string regexComment(R"(^;(.*)$)"); // fixed_string("^;(.*)$");
106 // static constexpr ctll::fixed_string regexFormat(R"(.*(?:FORMAT|format).*(\d).(\d))"); // fixed_string(".*(?:FORMAT|format).*(\d).(\d)");
107 static constexpr ctll::fixed_string regexTool(R"(\s*(?:HOLESIZE|holesize)\s*(\d+\.?\d*)\s*=\s*(\d+\.?\d*).*)"); // fixed_string("\s*(?:HOLESIZE|holesize)\s*(\d+\.?\d*)\s*=\s*(\d+\.?\d*).*");
108 if (auto [match, comment] = ctre::match<regexComment>(data); match) {
109 // if (auto [matchFormat, integer, decimal] = ctre::match<regexFormat>(comment); matchFormat) {
110 // file->m_format.integer = CtreCapTo(integer).toInt();
111 // file->m_format.decimal = CtreCapTo(decimal).toInt();
112 // }
113 if (auto [matchTool, tool, diam] = ctre::match<regexTool>(comment); matchTool) {
114 qDebug() << "regexTool" << matchTool.data();
115 const int tCode = static_cast<int>(CtreCapTo(tool).toDouble());
116 file->m_tools[tCode] = CtreCapTo(diam).toDouble();
117 file->m_tools[tCode] *= 0.0254 * (1.0 / 25.4);
118 m_state.tCode = tCode; //m_state.tCode = file->m_tools.firstKey();
119 }
120 return true;
121 }
122 }
123 return false;
124}
125
126bool Parser::parseGCode(const QString& line)
127{

Callers

nothing calls this directly

Calls 4

toU16StrViewFunction · 0.85
CtreCapToClass · 0.85
dataMethod · 0.45
toDoubleMethod · 0.45

Tested by

no test coverage detected