mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
Use std::getline to deserialize point list coords, fixes #2318
This commit is contained in:
parent
8a5a0b6726
commit
b0b9c17c23
1 changed files with 9 additions and 6 deletions
|
@ -295,18 +295,21 @@ class ConfigOptionPoints : public ConfigOption, public ConfigOptionVector<Pointf
|
||||||
};
|
};
|
||||||
|
|
||||||
bool deserialize(std::string str) {
|
bool deserialize(std::string str) {
|
||||||
std::vector<Pointf> values;
|
this->values.clear();
|
||||||
std::istringstream is(str);
|
std::istringstream is(str);
|
||||||
std::string point_str;
|
std::string point_str;
|
||||||
while (std::getline(is, point_str, ',')) {
|
while (std::getline(is, point_str, ',')) {
|
||||||
Pointf point;
|
Pointf point;
|
||||||
std::istringstream iss(point_str);
|
std::istringstream iss(point_str);
|
||||||
iss >> point.x;
|
std::string coord_str;
|
||||||
iss.ignore(std::numeric_limits<std::streamsize>::max(), 'x');
|
if (std::getline(iss, coord_str, 'x')) {
|
||||||
iss >> point.y;
|
std::istringstream(coord_str) >> point.x;
|
||||||
values.push_back(point);
|
if (std::getline(iss, coord_str, 'x')) {
|
||||||
|
std::istringstream(coord_str) >> point.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->values.push_back(point);
|
||||||
}
|
}
|
||||||
this->values = values;
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue