Base: make getAttribute template

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

View File

@@ -151,12 +151,12 @@ void PropertyCosmeticEdgeList::Restore(Base::XMLReader &reader)
reader.clearPartialRestoreObject();
reader.readElement("CosmeticEdgeList");
// get the value of my attribute
int count = reader.getAttributeAsInteger("count");
int count = reader.getAttribute<long>("count");
std::vector<CosmeticEdge*> values;
values.reserve(count);
for (int i = 0; i < count; i++) {
reader.readElement("CosmeticEdge");
const char* TypeName = reader.getAttribute("type");
const char* TypeName = reader.getAttribute<const char*>("type");
CosmeticEdge *newG = static_cast<CosmeticEdge *>(Base::Type::fromName(TypeName).createInstance());
newG->Restore(reader);