| 815 | } |
| 816 | |
| 817 | bool Parser::parseAttributes(const QString& gLine) |
| 818 | { |
| 819 | auto data { toU16StrView(gLine) }; |
| 820 | static constexpr ctll::fixed_string ptrnAttributes(R"(^%(T[FAOD])(\.?)(.*)\*%$)"); // fixed_string("^%(T[FAOD])(\.?)(.*)\*%$"); |
| 821 | if (auto [whole, c1, c2, c3] = ctre::match<ptrnAttributes>(data); whole) { |
| 822 | QString cap[] { CtreCapTo(whole), CtreCapTo(c1), CtreCapTo(c2), CtreCapTo(c3) }; |
| 823 | switch (Attr::Command::value(cap[1])) { |
| 824 | case Attr::Command::TF: |
| 825 | attFile.parse(cap[3].split(',')); |
| 826 | break; |
| 827 | case Attr::Command::TA: |
| 828 | attAper.parse(cap[3].split(',')); |
| 829 | break; |
| 830 | // break; |
| 831 | // { |
| 832 | // QStringList sl(matchAttr.cap(3).split(',')); |
| 833 | // int index = Attr::Aperture::value(sl.first()); |
| 834 | // switch (index) { |
| 835 | // case Attr::Aperture::AperFunction: |
| 836 | // if (sl.size() > 1) { |
| 837 | // switch (int key = Attr::AperFunction::value(sl[1])) { |
| 838 | // case Attr::AperFunction::ComponentMain: |
| 839 | // case Attr::AperFunction::ComponentOutline: |
| 840 | // case Attr::AperFunction::ComponentPin: |
| 841 | // aperFunction = key; |
| 842 | // break; |
| 843 | // default: |
| 844 | // aperFunction = -1; |
| 845 | // } |
| 846 | // } |
| 847 | // break; |
| 848 | // case Attr::Aperture::DrillTolerance: |
| 849 | // case Attr::Aperture::FlashText: |
| 850 | // default: |
| 851 | // ; |
| 852 | // } |
| 853 | // //apertureAttributesStrings.append(matchAttr.cap(2)); |
| 854 | // } |
| 855 | case Attr::Command::TO: { |
| 856 | for (int i = cap[3].indexOf('"'); i > -1; i = cap[3].indexOf('"')) |
| 857 | cap[3].remove(i, 1); |
| 858 | auto sl(cap[3].split(',')); // remove symbol " |
| 859 | switch (int index = Component::value1(sl.first()); index) { |
| 860 | case Component::N: // The CAD net name of a conducting object, e.g. Clk13. |
| 861 | break; |
| 862 | case Component::P: // Pins |
| 863 | components[sl.value(1)].addPin({ sl.value(2), sl.value(3), {} }); |
| 864 | break; |
| 865 | case Component::C: |
| 866 | switch (int key = Component::value2(sl.first())) { |
| 867 | case Component::Rot: |
| 868 | case Component::Mfr: |
| 869 | case Component::MPN: |
| 870 | case Component::Val: |
| 871 | case Component::Mnt: |
| 872 | case Component::Ftp: |
| 873 | case Component::PgN: |
| 874 | case Component::Hgt: |