Merge pull request #19907 from benj5378/getAttribute

Base: make getAttribute template
This commit is contained in:
Chris Hennes
2025-05-12 10:39:55 -05:00
committed by GitHub
64 changed files with 834 additions and 677 deletions

View File

@@ -351,6 +351,6 @@ void Command::Save(Writer& writer) const
void Command::Restore(XMLReader& reader)
{
reader.readElement("Command");
std::string gcode = reader.getAttribute("gcode");
std::string gcode = reader.getAttribute<const char*>("gcode");
setFromGCode(gcode);
}

View File

@@ -507,7 +507,7 @@ void Toolpath::SaveDocFile(Base::Writer& writer) const
void Toolpath::Restore(XMLReader& reader)
{
reader.readElement("Path");
std::string file(reader.getAttribute("file"));
std::string file(reader.getAttribute<const char*>("file"));
if (!file.empty()) {
// initiate a file read

View File

@@ -104,19 +104,19 @@ void PropertyPath::Restore(Base::XMLReader& reader)
{
reader.readElement("Path");
std::string file(reader.getAttribute("file"));
std::string file(reader.getAttribute<const char*>("file"));
if (!file.empty()) {
// initiate a file read
reader.addFile(file.c_str(), this);
}
if (reader.hasAttribute("version")) {
int version = reader.getAttributeAsInteger("version");
int version = reader.getAttribute<long>("version");
if (version >= Toolpath::SchemaVersion) {
reader.readElement("Center");
double x = reader.getAttributeAsFloat("x");
double y = reader.getAttributeAsFloat("y");
double z = reader.getAttributeAsFloat("z");
double x = reader.getAttribute<double>("x");
double y = reader.getAttribute<double>("y");
double z = reader.getAttribute<double>("z");
Base::Vector3d center(x, y, z);
_Path.setCenter(center);
}