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

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