| 25 | // Returns false if fewer than N tokens parse. |
| 26 | template <std::size_t N> |
| 27 | bool parseDoubles(const QString& text, std::array<double, N>& out) { |
| 28 | const QStringList toks = text.simplified().split(' ', Qt::SkipEmptyParts); |
| 29 | if (static_cast<std::size_t>(toks.size()) < N) { |
| 30 | return false; |
| 31 | } |
| 32 | for (std::size_t i = 0; i < N; ++i) { |
| 33 | bool ok = false; |
| 34 | out[i] = toks[static_cast<int>(i)].toDouble(&ok); |
| 35 | if (!ok) { |
| 36 | return false; |
| 37 | } |
| 38 | } |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | double attrDouble(const QDomElement& el, const QString& name, double fallback) { |
| 43 | if (!el.hasAttribute(name)) { |
no test coverage detected