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

@@ -867,29 +867,29 @@ void MeshInput::LoadXML(Base::XMLReader& reader)
// reader.readElement("Mesh");
reader.readElement("Points");
int Cnt = reader.getAttributeAsInteger("Count");
int Cnt = reader.getAttribute<long>("Count");
cPoints.resize(Cnt);
for (int i = 0; i < Cnt; i++) {
reader.readElement("P");
cPoints[i].x = (float)reader.getAttributeAsFloat("x");
cPoints[i].y = (float)reader.getAttributeAsFloat("y");
cPoints[i].z = (float)reader.getAttributeAsFloat("z");
cPoints[i].x = (float)reader.getAttribute<double>("x");
cPoints[i].y = (float)reader.getAttribute<double>("y");
cPoints[i].z = (float)reader.getAttribute<double>("z");
}
reader.readEndElement("Points");
reader.readElement("Faces");
Cnt = reader.getAttributeAsInteger("Count");
Cnt = reader.getAttribute<long>("Count");
cFacets.resize(Cnt);
for (int i = 0; i < Cnt; i++) {
reader.readElement("F");
cFacets[i]._aulPoints[0] = reader.getAttributeAsInteger("p0");
cFacets[i]._aulPoints[1] = reader.getAttributeAsInteger("p1");
cFacets[i]._aulPoints[2] = reader.getAttributeAsInteger("p2");
cFacets[i]._aulNeighbours[0] = reader.getAttributeAsInteger("n0");
cFacets[i]._aulNeighbours[1] = reader.getAttributeAsInteger("n1");
cFacets[i]._aulNeighbours[2] = reader.getAttributeAsInteger("n2");
cFacets[i]._aulPoints[0] = reader.getAttribute<long>("p0");
cFacets[i]._aulPoints[1] = reader.getAttribute<long>("p1");
cFacets[i]._aulPoints[2] = reader.getAttribute<long>("p2");
cFacets[i]._aulNeighbours[0] = reader.getAttribute<long>("n0");
cFacets[i]._aulNeighbours[1] = reader.getAttribute<long>("n1");
cFacets[i]._aulNeighbours[2] = reader.getAttribute<long>("n2");
}
reader.readEndElement("Faces");

View File

@@ -135,7 +135,7 @@ void PropertyNormalList::Save(Base::Writer& writer) const
void PropertyNormalList::Restore(Base::XMLReader& reader)
{
reader.readElement("VectorList");
std::string file(reader.getAttribute("file"));
std::string file(reader.getAttribute<const char*>("file"));
if (!file.empty()) {
// initiate a file read
@@ -326,7 +326,7 @@ void PropertyCurvatureList::Save(Base::Writer& writer) const
void PropertyCurvatureList::Restore(Base::XMLReader& reader)
{
reader.readElement("CurvatureList");
std::string file(reader.getAttribute("file"));
std::string file(reader.getAttribute<const char*>("file"));
if (!file.empty()) {
// initiate a file read
@@ -598,7 +598,7 @@ void PropertyMaterial::Restore(Base::XMLReader& reader)
{
reader.readElement("Material");
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
@@ -896,7 +896,7 @@ void PropertyMeshKernel::Save(Base::Writer& writer) const
void PropertyMeshKernel::Restore(Base::XMLReader& reader)
{
reader.readElement("Mesh");
std::string file(reader.getAttribute("file"));
std::string file(reader.getAttribute<const char*>("file"));
if (file.empty()) {
// read XML