Line data Source code
1 : /* Copyright (C) 2025 Robert Schiwon 2 : * 3 : * This file is part of libjdx. 4 : * 5 : * libjdx is free software: you can redistribute it and/or modify it under the 6 : * terms of the GNU Lesser General Public License as published by the Free 7 : * Software Foundation, either version 3 of the License, or (at your option) any 8 : * later version. 9 : * 10 : * libjdx is distributed in the hope that it will be useful, but WITHOUT ANY 11 : * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 12 : * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13 : * details. 14 : * 15 : * You should have received a copy of the GNU Lesser General Public License 16 : * along with libjdx. If not, see <https://www.gnu.org/licenses/>. 17 : */ 18 : #include "jdx/XyPoints.hpp" 19 : #include "jdx/ParseException.hpp" 20 : #include "jdx/XyBase.hpp" 21 : 22 21 : libjdx::jdx::XyPoints::XyPoints(const std::string& label, 23 : const std::string& variableList, const std::vector<StringLdr>& ldrs, 24 21 : io::TextReader& reader, std::optional<std::string>& nextLine) 25 : : XyBase(label, variableList, ldrs, s_xyPointsLabel, 26 42 : std::vector<std::string>{ 27 : s_xyPointsVariableLists.begin(), s_xyPointsVariableLists.end()}, 28 42 : reader, nextLine) 29 : { 30 21 : } 31 : 32 9 : std::vector<std::pair<double, double>> libjdx::jdx::XyPoints::getData() const 33 : { 34 18 : auto varList = getVariableList(); 35 9 : if (std::any_of(s_xyPointsVariableLists.begin(), 36 : s_xyPointsVariableLists.end(), 37 12 : [&varList](const std::string& s) { return s == varList; })) 38 : { 39 14 : return XyBase::getXYXYData(); 40 : } 41 0 : throw ParseException("Unsupported variable list for XYPOINTS: " + varList); 42 : }