Remove XERO_ITER_EL

This commit is contained in:
phosit
2026-09-07 18:06:58 +02:00
parent f8ea2c0d49
commit 7bcee2ea0e
16 changed files with 52 additions and 55 deletions
+12 -12
View File
@@ -440,7 +440,7 @@ PSRETURN CMapSummaryReader::LoadMap(const VfsPath& pathname)
XMBElement root = xmb_file.GetRoot();
ENSURE(root.GetNodeName() == el_scenario);
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
int child_name = child.GetNodeName();
if (child_name == el_scriptsettings)
@@ -565,7 +565,7 @@ void CXMLReader::Init(const VfsPath& xml_filename)
max_uid = SYSTEM_ENTITY;
XMBElement ents = nodes.GetFirstNamedItem(xmb_file.GetElementID("Entities"));
XERO_ITER_EL(ents, ent)
for (XMBElement ent : ents.GetChildNodes())
{
CStr uid = ent.GetAttributes().GetNamedItem(at_uid);
max_uid = std::max(max_uid, (entity_id_t)uid.ToUInt());
@@ -677,7 +677,7 @@ void CXMLReader::ReadEnvironment(XMBElement parent)
#undef AT
#undef EL
XERO_ITER_EL(parent, element)
for (XMBElement element : parent.GetChildNodes())
{
int element_name = element.GetNodeName();
@@ -712,7 +712,7 @@ void CXMLReader::ReadEnvironment(XMBElement parent)
}
else if (element_name == el_fog)
{
XERO_ITER_EL(element, fog)
for (XMBElement fog : element.GetChildNodes())
{
int fog_element_name = fog.GetNodeName();
if (fog_element_name == el_fogcolor)
@@ -735,7 +735,7 @@ void CXMLReader::ReadEnvironment(XMBElement parent)
}
else if (element_name == el_postproc)
{
XERO_ITER_EL(element, postproc)
for (XMBElement postproc : element.GetChildNodes())
{
int post_element_name = postproc.GetNodeName();
if (post_element_name == el_brightness)
@@ -763,10 +763,10 @@ void CXMLReader::ReadEnvironment(XMBElement parent)
}
else if (element_name == el_water)
{
XERO_ITER_EL(element, waterbody)
for (XMBElement waterbody : element.GetChildNodes())
{
ENSURE(waterbody.GetNodeName() == el_waterbody);
XERO_ITER_EL(waterbody, waterelement)
for (XMBElement waterelement : waterbody.GetChildNodes())
{
int water_element_name = waterelement.GetNodeName();
if (water_element_name == el_height)
@@ -844,7 +844,7 @@ void CXMLReader::ReadCamera(XMBElement parent)
float declination = DEGTORAD(30.f), rotation = DEGTORAD(-45.f);
CVector3D translation = CVector3D(100, 150, -100);
XERO_ITER_EL(parent, element)
for (XMBElement element : parent.GetChildNodes())
{
int element_name = element.GetNodeName();
@@ -903,7 +903,7 @@ void CXMLReader::ReadPaths(XMBElement parent)
#undef AT
CmpPtr<ICmpCinemaManager> cmpCinemaManager(*m_MapReader.pSimContext, SYSTEM_ENTITY);
XERO_ITER_EL(parent, element)
for (XMBElement element : parent.GetChildNodes())
{
int elementName = element.GetNodeName();
@@ -922,7 +922,7 @@ void CXMLReader::ReadPaths(XMBElement parent)
fixed lastPositionTime = fixed::Zero();
fixed lastTargetTime = fixed::Zero();
XERO_ITER_EL(element, pathChild)
for (XMBElement pathChild : element.GetChildNodes())
{
elementName = pathChild.GetNodeName();
attrs = pathChild.GetAttributes();
@@ -932,7 +932,7 @@ void CXMLReader::ReadPaths(XMBElement parent)
{
lastPositionTime += fixed::FromString(attrs.GetNamedItem(at_deltatime));
lastTargetTime += fixed::FromString(attrs.GetNamedItem(at_deltatime));
XERO_ITER_EL(pathChild, nodeChild)
for (XMBElement nodeChild : pathChild.GetChildNodes())
{
elementName = nodeChild.GetNodeName();
attrs = nodeChild.GetAttributes();
@@ -1012,7 +1012,7 @@ void CXMLReader::ReadEntities(XMBElement entity, CSimulation2& sim)
entity_id_t ControlGroup = INVALID_ENTITY;
entity_id_t ControlGroup2 = INVALID_ENTITY;
XERO_ITER_EL(entity, setting)
for (XMBElement setting : entity.GetChildNodes())
{
int element_name = setting.GetNodeName();
+1 -1
View File
@@ -113,7 +113,7 @@ CMaterial CMaterialManager::LoadMaterial(const VfsPath& pathname)
material.AddStaticUniform("qualityLevel", CVector4D(qualityLevel, 0, 0, 0));
XMBElement root = xeroFile.GetRoot();
XERO_ITER_EL(root, node)
for (XMBElement node : root.GetChildNodes())
{
int token = node.GetNodeName();
XMBAttributeList attrs = node.GetAttributes();
+9 -9
View File
@@ -101,7 +101,7 @@ bool CObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root)
// Set up the group vector to avoid reallocation and copying later.
{
int groups = 0;
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
if (child.GetNodeName() == el_group)
++groups;
@@ -123,7 +123,7 @@ bool CObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root)
return false;
};
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
int child_name = child.GetNodeName();
@@ -134,7 +134,7 @@ bool CObjectBase::Load(const CXeromyces& XeroFile, const XMBElement& root)
{
std::vector<Variant>& currentGroup = m_VariantGroups.emplace_back();
currentGroup.reserve(child.GetChildNodes().size());
XERO_ITER_EL(child, variant)
for (XMBElement variant : child.GetChildNodes())
{
if (shouldSkip(variant))
continue;
@@ -239,7 +239,7 @@ bool CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& vari
currentVariant.m_Frequency = attr.Value.ToInt();
}
XERO_ITER_EL(variant, option)
for (XMBElement option : variant.GetChildNodes())
{
int option_name = option.GetNodeName();
@@ -249,7 +249,7 @@ bool CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& vari
}
else if (option_name == el_textures)
{
XERO_ITER_EL(option, textures_element)
for (XMBElement textures_element : option.GetChildNodes())
{
if (textures_element.GetNodeName() != el_texture)
{
@@ -295,7 +295,7 @@ bool CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& vari
}
else if (option_name == el_animations)
{
XERO_ITER_EL(option, anim_element)
for (XMBElement anim_element : option.GetChildNodes())
{
if (anim_element.GetNodeName() != el_animation)
{
@@ -328,7 +328,7 @@ bool CObjectBase::LoadVariant(const CXeromyces& XeroFile, const XMBElement& vari
}
else if (option_name == el_props)
{
XERO_ITER_EL(option, prop_element)
for (XMBElement prop_element : option.GetChildNodes())
{
ENSURE(prop_element.GetNodeName() == el_prop);
@@ -878,12 +878,12 @@ bool CActorDef::Load(const VfsPath& pathname)
}
u8 quality = 0;
XMBElement inlineActor;
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
if (child.GetNodeName() == el_inline)
inlineActor = child;
}
XERO_ITER_EL(root, actor)
for (XMBElement actor : root.GetChildNodes())
{
if (actor.GetNodeName() != el_actor)
continue;
+2 -2
View File
@@ -435,7 +435,7 @@ bool CParticleEmitterType::LoadXML(const VfsPath& path)
XMBElement Root = XeroFile.GetRoot();
XERO_ITER_EL(Root, Child)
for (XMBElement Child : Root.GetChildNodes())
{
if (Child.GetNodeName() == el_texture)
{
@@ -531,7 +531,7 @@ bool CParticleEmitterType::LoadXML(const VfsPath& path)
}
else if (Child.GetNodeName() == el_particle)
{
XERO_ITER_EL(Child, particleChild)
for (XMBElement particleChild : Child.GetChildNodes())
{
if (particleChild.GetNodeName() == el_fixed_orientation)
{
+5 -5
View File
@@ -223,11 +223,11 @@ bool CShaderManager::LoadTechnique(CShaderTechniquePtr& tech)
// Find a first suitable technique that we can use.
std::optional<XMBElement> usableTech;
std::optional<std::string_view> usableShader;
XERO_ITER_EL(root, technique)
for (XMBElement technique : root.GetChildNodes())
{
bool isUsable{true};
usableShader.reset();
XERO_ITER_EL(technique, child)
for (XMBElement child : technique.GetChildNodes())
{
XMBAttributeList attrs = child.GetAttributes();
@@ -276,7 +276,7 @@ bool CShaderManager::LoadTechnique(CShaderTechniquePtr& tech)
};
CShaderDefines techDefines = tech->GetShaderDefines();
XERO_ITER_EL((*usableTech), Child)
for (XMBElement Child : usableTech->GetChildNodes())
{
if (Child.GetNodeName() == el_define)
{
@@ -292,7 +292,7 @@ bool CShaderManager::LoadTechnique(CShaderTechniquePtr& tech)
// TODO: we might want to implement that in a proper way via splitting passes
// and tags in different groups in XML.
std::vector<CShaderPass> techPasses;
XERO_ITER_EL((*usableTech), Child)
for (XMBElement Child : usableTech->GetChildNodes())
{
if (Child.GetNodeName() == el_pass)
{
@@ -301,7 +301,7 @@ bool CShaderManager::LoadTechnique(CShaderTechniquePtr& tech)
Renderer::Backend::SGraphicsPipelineStateDesc passPipelineStateDesc =
Renderer::Backend::MakeDefaultGraphicsPipelineStateDesc();
XERO_ITER_EL(Child, Element)
for (XMBElement Element : Child.GetChildNodes())
{
if (Element.GetNodeName() == el_define)
{
+1 -1
View File
@@ -76,7 +76,7 @@ CTerrainPropertiesPtr CTerrainProperties::FromXML(const CTerrainPropertiesPtr& p
// returning it.
// Really, we only expect there to be one child and it to be of the right
// type, though.
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
if (child.GetNodeName() == el_terrain)
{
+2 -2
View File
@@ -83,13 +83,13 @@ CTerrainTextureEntry::CTerrainTextureEntry(CTerrainPropertiesPtr properties, con
VfsPath alphamap("standard");
m_Tag = utf8_from_wstring(path.Basename().string());
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
int child_name = child.GetNodeName();
if (child_name == el_textures)
{
XERO_ITER_EL(child, textures_element)
for (XMBElement textures_element : child.GetChildNodes())
{
ENSURE(textures_element.GetNodeName() == el_texture);
+1 -1
View File
@@ -164,7 +164,7 @@ CTextureConverter::SettingsFile* CTextureConverter::LoadSettings(const VfsPath&
std::unique_ptr<SettingsFile> settings = std::make_unique<SettingsFile>();
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
if (child.GetNodeName() == el_file)
{
+1 -1
View File
@@ -979,7 +979,7 @@ void CGUI::Xeromyces_ReadRepeat(const XMBData& xmb, XMBElement element, IGUIObje
{
NameSubst.emplace_back(var, fmt::format("[{}]", n));
XERO_ITER_EL(element, child)
for (XMBElement child : element.GetChildNodes())
{
if (child.GetNodeName() == elmt_object)
Xeromyces_ReadObject(xmb, child, parent, NameSubst, Paths, nesting_depth);
+1 -1
View File
@@ -211,7 +211,7 @@ void CGUIManager::SGUIPage::LoadPage(Script::Context& scriptContext)
}
VfsPath rootModule;
XERO_ITER_EL(root, node)
for (XMBElement node : root.GetChildNodes())
{
if (node.GetNodeName() != elmt_include)
{
+1 -1
View File
@@ -135,7 +135,7 @@ void XMLWriter_File::ElementXMB(const XMBData& xmb, XMBElement el)
for (XMBAttribute attr : el.GetAttributes())
writer.Attribute(xmb.GetAttributeString(attr.Name), attr.Value);
XERO_ITER_EL(el, child)
for (XMBElement child : el.GetChildNodes())
ElementXMB(xmb, child);
}
-3
View File
@@ -91,7 +91,4 @@ private:
#define _XERO_CHILDREN _XERO_MAKE_UID1__(_children_, __LINE__)
#define _XERO_I _XERO_MAKE_UID1__(_i_, __LINE__)
#define XERO_ITER_EL(parent_element, child_element) \
for (XMBElement child_element : parent_element.GetChildNodes())
#endif // INCLUDED_XEROMYCES
+3 -3
View File
@@ -929,7 +929,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
VfsPath computeFile;
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
if (child.GetNodeName() == el_define)
{
@@ -939,7 +939,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
{
vertexFile = L"shaders/" + child.GetAttributes().GetNamedItem(at_file).FromUTF8();
XERO_ITER_EL(child, param)
for (XMBElement param : child.GetChildNodes())
{
XMBAttributeList attributes = param.GetAttributes();
@@ -996,7 +996,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(CDevice* device, const CS
{
fragmentFile = L"shaders/" + child.GetAttributes().GetNamedItem(at_file).FromUTF8();
XERO_ITER_EL(child, param)
for (XMBElement param : child.GetChildNodes())
{
XMBAttributeList attributes = param.GetAttributes();
@@ -1,4 +1,4 @@
/* Copyright (C) 2025 Wildfire Games.
/* Copyright (C) 2026 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -124,16 +124,16 @@ VfsPath FindProgramMatchingDefines(const VfsPath& xmlFilename, const CShaderDefi
const CStrIntern strUndefined("UNDEFINED");
VfsPath programFilename;
XMBElement root = xeroFile.GetRoot();
XERO_ITER_EL(root, rootChild)
for (XMBElement rootChild : root.GetChildNodes())
{
if (rootChild.GetNodeName() == el_program)
{
CShaderDefines programDefines;
XERO_ITER_EL(rootChild, programChild)
for (XMBElement programChild : rootChild.GetChildNodes())
{
if (programChild.GetNodeName() == el_defines)
{
XERO_ITER_EL(programChild, definesChild)
for (XMBElement definesChild : programChild.GetChildNodes())
{
XMBAttributeList attributes = definesChild.GetAttributes();
if (definesChild.GetNodeName() == el_define)
@@ -269,7 +269,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
const bool useDescriptorIndexing =
device->GetDescriptorManager().UseDescriptorIndexing();
// TODO: reduce the indentation.
XERO_ITER_EL(element, descriporSetsChild)
for (XMBElement descriporSetsChild : element.GetChildNodes())
{
if (descriporSetsChild.GetNodeName() == el_descriptor_set)
{
@@ -279,7 +279,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
LOGERROR("Descriptor set for descriptor indexing shouldn't contain bindings.");
return false;
}
XERO_ITER_EL(descriporSetsChild, descriporSetChild)
for (XMBElement descriporSetChild : descriporSetsChild.GetChildNodes())
{
if (descriporSetChild.GetNodeName() == el_binding)
{
@@ -297,7 +297,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
return false;
}
shaderProgram->m_MaterialConstantsDataSize = size;
XERO_ITER_EL(descriporSetChild, bindingChild)
for (XMBElement bindingChild : descriporSetChild.GetChildNodes())
{
if (bindingChild.GetNodeName() == el_member)
{
@@ -384,7 +384,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
return true;
};
XERO_ITER_EL(programRoot, programChild)
for (XMBElement programChild : programRoot.GetChildNodes())
{
if (programChild.GetNodeName() == el_vertex)
{
@@ -408,7 +408,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
vertexShaderStageInfo.module = shaderProgram->m_ShaderModules.back();
vertexShaderStageInfo.pName = "main";
shaderProgram->m_Stages.emplace_back(std::move(vertexShaderStageInfo));
XERO_ITER_EL(programChild, stageChild)
for (XMBElement stageChild : programChild.GetChildNodes())
{
if (stageChild.GetNodeName() == el_stream)
{
@@ -476,7 +476,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
fragmentShaderStageInfo.module = shaderProgram->m_ShaderModules.back();
fragmentShaderStageInfo.pName = "main";
shaderProgram->m_Stages.emplace_back(std::move(fragmentShaderStageInfo));
XERO_ITER_EL(programChild, stageChild)
for (XMBElement stageChild : programChild.GetChildNodes())
{
if (stageChild.GetNodeName() == el_push_constant)
{
@@ -512,7 +512,7 @@ std::unique_ptr<CShaderProgram> CShaderProgram::Create(
computeShaderStageInfo.module = shaderProgram->m_ShaderModules.back();
computeShaderStageInfo.pName = "main";
shaderProgram->m_Stages.emplace_back(std::move(computeShaderStageInfo));
XERO_ITER_EL(programChild, stageChild)
for (XMBElement stageChild : programChild.GetChildNodes())
{
if (stageChild.GetNodeName() == el_push_constant)
{
+1 -1
View File
@@ -229,7 +229,7 @@ void CParamNode::ApplyLayer(const XMBData& xmb, const XMBElement& element, const
ChildrenMap childs;
// Recurse through the element's children
XERO_ITER_EL(element, child)
for (XMBElement child : element.GetChildNodes())
{
node.ApplyLayer(xmb, child, sourceIdentifier);
if (filtering)
+1 -1
View File
@@ -350,7 +350,7 @@ bool CSoundGroup::LoadSoundGroup(const VfsPath& pathnameXML)
return false;
}
XERO_ITER_EL(root, child)
for (XMBElement child : root.GetChildNodes())
{
int child_name = child.GetNodeName();