Base: make getAttribute template

This commit is contained in:
Benjamin Bræstrup Sayoc
2025-02-25 20:32:11 +01:00
parent 7f49550dee
commit 2b1aec0041
64 changed files with 834 additions and 675 deletions

View File

@@ -327,26 +327,26 @@ void PropertyPartShape::Restore(Base::XMLReader &reader)
_Ver = "?";
bool has_ver = reader.hasAttribute("ElementMap");
if (has_ver)
_Ver = reader.getAttribute("ElementMap");
_Ver = reader.getAttribute<const char*>("ElementMap");
int hasher_idx = static_cast<int>(reader.getAttributeAsInteger("HasherIndex", "-1"));
int save_hasher = static_cast<int>(reader.getAttributeAsInteger("SaveHasher", "0"));
int hasher_idx = reader.getAttribute<int>("HasherIndex", -1);
int save_hasher = reader.getAttribute<int>("SaveHasher", 0);
TopoShape shape;
if (reader.hasAttribute("file")) {
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);
}
}
else if (reader.hasAttribute(("binary")) && reader.getAttributeAsInteger("binary")) {
else if (reader.hasAttribute(("binary")) && reader.getAttribute<long>("binary")) {
TopoShape shape;
shape.importBinary(reader.beginCharStream());
shape = shape.getShape();
}
else if (reader.hasAttribute("brep") && reader.getAttributeAsInteger("brep")) {
else if (reader.hasAttribute("brep") && reader.getAttribute<long>("brep")) {
shape.importBrep(reader.beginCharStream(Base::CharStreamFormat::Raw));
}
@@ -843,7 +843,7 @@ void PropertyFilletEdges::Save (Base::Writer &writer) const
void PropertyFilletEdges::Restore(Base::XMLReader &reader)
{
reader.readElement("FilletEdges");
std::string file (reader.getAttribute("file") );
std::string file (reader.getAttribute<const char*>("file") );
if (!file.empty()) {
// initiate a file read