diff --git a/examples/GUI/WidgetsDemo.h b/examples/GUI/WidgetsDemo.h index 79645da241..d19114c79f 100644 --- a/examples/GUI/WidgetsDemo.h +++ b/examples/GUI/WidgetsDemo.h @@ -917,7 +917,7 @@ public: table.setOutlineThickness (1); // Add some columns to the table header, based on the column list in our database.. - forEachXmlChildElement (*columnList, columnXml) + for (auto* columnXml : columnList->getChildIterator()) { table.getHeader().addColumn (columnXml->getStringAttribute ("name"), columnXml->getIntAttribute ("columnId"), @@ -1212,7 +1212,7 @@ private: // (a utility method to search our XML for the attribute that matches a column ID) String getAttributeNameForColumnId (const int columnId) const { - forEachXmlChildElement (*columnList, columnXml) + for (auto* columnXml : columnList->getChildIterator()) { if (columnXml->getIntAttribute ("columnId") == columnId) return columnXml->getStringAttribute ("name"); diff --git a/examples/Utilities/XMLandJSONDemo.h b/examples/Utilities/XMLandJSONDemo.h index 76528267b6..1d67f54e86 100644 --- a/examples/Utilities/XMLandJSONDemo.h +++ b/examples/Utilities/XMLandJSONDemo.h @@ -95,7 +95,7 @@ public: // create and add sub-items to this node of the tree, corresponding to // each sub-element in the XML.. - forEachXmlChildElement (xml, child) + for (auto* child : xml.getChildIterator()) { jassert (child != nullptr); addSubItem (new XmlTreeItem (*child)); diff --git a/extras/AudioPluginHost/Source/Plugins/PluginGraph.cpp b/extras/AudioPluginHost/Source/Plugins/PluginGraph.cpp index ce45ba187f..0cedbcac32 100644 --- a/extras/AudioPluginHost/Source/Plugins/PluginGraph.cpp +++ b/extras/AudioPluginHost/Source/Plugins/PluginGraph.cpp @@ -272,7 +272,7 @@ static void readBusLayoutFromXml (AudioProcessor::BusesLayout& busesLayout, Audi if (auto* buses = xml.getChildByName (isInput ? "INPUTS" : "OUTPUTS")) { - forEachXmlChildElementWithTagName (*buses, e, "BUS") + for (auto* e : buses->getChildWithTagNameIterator ("BUS")) { const int busIdx = e->getIntAttribute ("index"); maxNumBuses = jmax (maxNumBuses, busIdx + 1); @@ -377,7 +377,7 @@ void PluginGraph::createNodeFromXml (const XmlElement& xml) { PluginDescription pd; - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) { if (pd.loadFromXml (*e)) break; @@ -461,13 +461,13 @@ void PluginGraph::restoreFromXml (const XmlElement& xml) { clear(); - forEachXmlChildElementWithTagName (xml, e, "FILTER") + for (auto* e : xml.getChildWithTagNameIterator ("FILTER")) { createNodeFromXml (*e); changed(); } - forEachXmlChildElementWithTagName (xml, e, "CONNECTION") + for (auto* e : xml.getChildWithTagNameIterator ("CONNECTION")) { graph.addConnection ({ { NodeID ((uint32) e->getIntAttribute ("srcFilter")), e->getIntAttribute ("srcChannel") }, { NodeID ((uint32) e->getIntAttribute ("dstFilter")), e->getIntAttribute ("dstChannel") } }); diff --git a/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp b/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp index 8b23e0ee59..235a919919 100644 --- a/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp +++ b/extras/Build/juce_build_tools/utils/juce_PlistOptions.cpp @@ -30,7 +30,7 @@ namespace build_tools //============================================================================== static bool keyFoundAndNotSequentialDuplicate (XmlElement& xml, const String& key) { - forEachXmlChildElementWithTagName (xml, element, "key") + for (auto* element : xml.getChildWithTagNameIterator ("key")) { if (element->getAllSubText().trim().equalsIgnoreCase (key)) { diff --git a/extras/Projucer/Source/CodeEditor/jucer_OpenDocumentManager.cpp b/extras/Projucer/Source/CodeEditor/jucer_OpenDocumentManager.cpp index e1586711d8..22cf720052 100644 --- a/extras/Projucer/Source/CodeEditor/jucer_OpenDocumentManager.cpp +++ b/extras/Projucer/Source/CodeEditor/jucer_OpenDocumentManager.cpp @@ -381,7 +381,7 @@ static void restoreDocList (Project& project, Array getChildWithTagNameIterator ("DOC")) { const File file (e->getStringAttribute ("file")); diff --git a/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h b/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h index c72f5e829d..6f1f8503a5 100644 --- a/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h +++ b/extras/Projucer/Source/ComponentEditor/Components/jucer_TabbedComponentHandler.h @@ -82,7 +82,7 @@ public: t->clearTabs(); - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) { addNewTab (t); restoreTabState (t, t->getNumTabs() - 1, *e); diff --git a/extras/Projucer/Source/ComponentEditor/Documents/jucer_ButtonDocument.cpp b/extras/Projucer/Source/ComponentEditor/Documents/jucer_ButtonDocument.cpp index 56fe29480c..c74d8f6f68 100644 --- a/extras/Projucer/Source/ComponentEditor/Documents/jucer_ButtonDocument.cpp +++ b/extras/Projucer/Source/ComponentEditor/Documents/jucer_ButtonDocument.cpp @@ -193,7 +193,7 @@ bool ButtonDocument::loadFromXml (const XmlElement& xml) for (int i = 7; --i >= 0;) paintStatesEnabled [i] = false; - forEachXmlChildElementWithTagName (xml, e, PaintRoutine::xmlTagName) + for (auto* e : xml.getChildWithTagNameIterator (PaintRoutine::xmlTagName)) { const int stateIndex = stateNameToIndex (e->getStringAttribute ("buttonState")); diff --git a/extras/Projucer/Source/ComponentEditor/Documents/jucer_ComponentDocument.cpp b/extras/Projucer/Source/ComponentEditor/Documents/jucer_ComponentDocument.cpp index 274319c932..62a412ea05 100644 --- a/extras/Projucer/Source/ComponentEditor/Documents/jucer_ComponentDocument.cpp +++ b/extras/Projucer/Source/ComponentEditor/Documents/jucer_ComponentDocument.cpp @@ -74,7 +74,7 @@ bool ComponentDocument::loadFromXml (const XmlElement& xml) { components->clearComponents(); - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) { if (e->hasTagName (PaintRoutine::xmlTagName)) backgroundGraphics->loadFromXml (*e); diff --git a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp index f353f9e2ae..e9efb40f73 100644 --- a/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp +++ b/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementGroup.cpp @@ -192,7 +192,7 @@ bool PaintElementGroup::loadFromXml (const XmlElement& xml) { if (xml.hasTagName (getTagName())) { - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) if (PaintElement* const pe = ObjectTypes::createElementForXml (e, owner)) subElements.add (pe); diff --git a/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp b/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp index bc23a1dfea..ad12490a97 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp +++ b/extras/Projucer/Source/ComponentEditor/jucer_ComponentLayout.cpp @@ -274,7 +274,7 @@ void ComponentLayout::paste() { selected.deselectAll(); - forEachXmlChildElement (*doc, e) + for (auto* e : doc->getChildIterator()) if (Component* newComp = addComponentFromXml (*e, true)) selected.addToSelection (newComp); diff --git a/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp b/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp index 2513af5dc4..177028fac3 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp +++ b/extras/Projucer/Source/ComponentEditor/jucer_JucerDocument.cpp @@ -385,7 +385,7 @@ bool JucerDocument::loadFromXml (const XmlElement& xml) activeExtraMethods.clear(); if (XmlElement* const methods = xml.getChildByName ("METHODS")) - forEachXmlChildElementWithTagName (*methods, e, "METHOD") + for (auto* e : methods->getChildWithTagNameIterator ("METHOD")) activeExtraMethods.addIfNotAlreadyThere (e->getStringAttribute ("name")); activeExtraMethods.trim(); diff --git a/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.cpp b/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.cpp index 69c35f6caf..20dbb5dac2 100644 --- a/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.cpp +++ b/extras/Projucer/Source/ComponentEditor/jucer_PaintRoutine.cpp @@ -306,7 +306,7 @@ void PaintRoutine::paste() selectedElements.deselectAll(); selectedPoints.deselectAll(); - forEachXmlChildElement (*doc, e) + for (auto* e : doc->getChildIterator()) if (PaintElement* newElement = addElementFromXml (*e, -1, true)) selectedElements.addToSelection (newElement); } @@ -610,7 +610,7 @@ bool PaintRoutine::loadFromXml (const XmlElement& xml) clear(); - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) if (auto* newElement = ObjectTypes::createElementForXml (e, this)) elements.add (newElement); diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h index 304078a0e1..03c58d930f 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Android.h @@ -1633,7 +1633,7 @@ private: { auto permissions = getPermissionsRequired(); - forEachXmlChildElementWithTagName (manifest, child, "uses-permission") + for (auto* child : manifest.getChildWithTagNameIterator ("uses-permission")) { permissions.removeString (child->getStringAttribute ("android:name"), false); } @@ -1648,7 +1648,7 @@ private: { XmlElement* glVersion = nullptr; - forEachXmlChildElementWithTagName (manifest, child, "uses-feature") + for (auto* child : manifest.getChildWithTagNameIterator ("uses-feature")) { if (child->getStringAttribute ("android:glEsVersion").isNotEmpty()) { diff --git a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h index d389779fa2..4f64bc9945 100644 --- a/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h +++ b/extras/Projucer/Source/ProjectSaving/jucer_ProjectExport_Xcode.h @@ -3243,7 +3243,7 @@ private: static StringArray parseNamesOfTargetsFromPlist (const XmlElement& dictXML) { - forEachXmlChildElementWithTagName (dictXML, schemesKey, "key") + for (auto* schemesKey : dictXML.getChildWithTagNameIterator ("key")) { if (schemesKey->getAllSubText().trim().equalsIgnoreCase ("SchemeUserState")) { @@ -3253,7 +3253,7 @@ private: { StringArray names; - forEachXmlChildElementWithTagName (*dict, key, "key") + for (auto* key : dict->getChildWithTagNameIterator ("key")) names.add (key->getAllSubText().upToLastOccurrenceOf (".xcscheme", false, false).trim()); names.sort (false); diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index a19c7b05e3..f613f16479 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -339,7 +339,7 @@ String AudioDeviceManager::initialiseFromXML (const XmlElement& xml, midiDeviceInfosFromXml.clear(); enabledMidiInputs.clear(); - forEachXmlChildElementWithTagName (xml, c, "MIDIINPUT") + for (auto* c : xml.getChildWithTagNameIterator ("MIDIINPUT")) midiDeviceInfosFromXml.add ({ c->getStringAttribute ("name"), c->getStringAttribute ("identifier") }); auto isIdentifierAvailable = [] (const Array& available, const String& identifier) diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp index d3b19a211b..1a51ae11d2 100644 --- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp +++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp @@ -382,7 +382,7 @@ private: switchValueType.entries.add (new Entry({ TRANS("Off"), Range ("[0, 0.5[") })); switchValueType.entries.add (new Entry({ TRANS("On"), Range ("[0.5, 1]") })); - forEachXmlChildElement (xml, item) + for (auto* item : xml.getChildIterator()) { if (item->hasTagName ("Param")) parseParam (*item, nullptr, nullptr); else if (item->hasTagName ("ValueType")) parseValueType (*item); @@ -436,7 +436,7 @@ private: int curEntry = 0; const int numEntries = item.getNumChildElements(); - forEachXmlChildElementWithTagName (item, entryXml, "Entry") + for (auto* entryXml : item.getChildWithTagNameIterator ("Entry")) { auto entry = new Entry(); entry->name = entryXml->getStringAttribute ("name"); @@ -465,7 +465,7 @@ private: templates.add (temp); temp->name = item.getStringAttribute ("name"); - forEachXmlChildElement (item, param) + for (auto* param : item.getChildIterator()) parseParam (*param, nullptr, temp); } @@ -514,7 +514,7 @@ private: } else { - forEachXmlChildElement (item, subItem) + for (auto* subItem : item.getChildIterator()) { if (subItem->hasTagName ("Param")) parseParam (*subItem, group, nullptr); else if (subItem->hasTagName ("Group")) parseGroup (*subItem, group); diff --git a/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp b/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp index 1bfc781979..f27070b963 100644 --- a/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp +++ b/modules/juce_audio_processors/scanning/juce_KnownPluginList.cpp @@ -378,7 +378,7 @@ void KnownPluginList::recreateFromXml (const XmlElement& xml) if (xml.hasTagName ("KNOWNPLUGINS")) { - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) { PluginDescription info; diff --git a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm index 44e9925133..cea8dcaf99 100644 --- a/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm +++ b/modules/juce_audio_utils/native/juce_mac_AudioCDReader.mm @@ -30,7 +30,7 @@ namespace CDReaderHelpers { inline const XmlElement* getElementForKey (const XmlElement& xml, const String& key) { - forEachXmlChildElementWithTagName (xml, child, "key") + for (auto* child : xml.getChildWithTagNameIterator ("key")) if (child->getAllSubText().trim() == key) return child->getNextElement(); @@ -71,7 +71,7 @@ namespace CDReaderHelpers if (trackArray == nullptr) return "Couldn't find Track Array"; - forEachXmlChildElement (*trackArray, track) + for (auto* track : trackArray->getChildIterator()) { const int trackValue = getIntValueForKey (*track, "Start Block"); if (trackValue < 0) diff --git a/modules/juce_core/containers/juce_PropertySet.cpp b/modules/juce_core/containers/juce_PropertySet.cpp index 4912825714..d00b63c891 100644 --- a/modules/juce_core/containers/juce_PropertySet.cpp +++ b/modules/juce_core/containers/juce_PropertySet.cpp @@ -196,7 +196,7 @@ void PropertySet::restoreFromXml (const XmlElement& xml) const ScopedLock sl (lock); clear(); - forEachXmlChildElementWithTagName (xml, e, "VALUE") + for (auto* e : xml.getChildWithTagNameIterator ("VALUE")) { if (e->hasAttribute ("name") && e->hasAttribute ("val")) diff --git a/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp b/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp index 7b437cb714..bc1d1a110c 100644 --- a/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp +++ b/modules/juce_data_structures/app_properties/juce_PropertiesFile.cpp @@ -187,7 +187,7 @@ bool PropertiesFile::loadAsXml() { if (auto doc = parseXMLIfTagMatches (file, PropertyFileConstants::fileTag)) { - forEachXmlChildElementWithTagName (*doc, e, PropertyFileConstants::valueTag) + for (auto* e : doc->getChildWithTagNameIterator (PropertyFileConstants::valueTag)) { auto name = e->getStringAttribute (PropertyFileConstants::nameAttribute); diff --git a/modules/juce_data_structures/values/juce_ValueTree.cpp b/modules/juce_data_structures/values/juce_ValueTree.cpp index 088f74d0e2..704ddf8110 100644 --- a/modules/juce_data_structures/values/juce_ValueTree.cpp +++ b/modules/juce_data_structures/values/juce_ValueTree.cpp @@ -1003,7 +1003,7 @@ ValueTree ValueTree::fromXml (const XmlElement& xml) ValueTree v (xml.getTagName()); v.object->properties.setFromXmlAttributes (xml); - forEachXmlChildElement (xml, e) + for (auto* e : xml.getChildIterator()) v.appendChild (fromXml (*e), nullptr); return v; diff --git a/modules/juce_graphics/native/juce_linux_Fonts.cpp b/modules/juce_graphics/native/juce_linux_Fonts.cpp index a5cfd58423..fbb000d252 100644 --- a/modules/juce_graphics/native/juce_linux_Fonts.cpp +++ b/modules/juce_graphics/native/juce_linux_Fonts.cpp @@ -49,7 +49,7 @@ StringArray FTTypefaceList::getDefaultFontDirectories() { if (auto fontsInfo = findFontsConfFile()) { - forEachXmlChildElementWithTagName (*fontsInfo, e, "dir") + for (auto* e : fontsInfo->getChildWithTagNameIterator ("dir")) { auto fontPath = e->getAllSubText().trim(); diff --git a/modules/juce_gui_basics/commands/juce_KeyPressMappingSet.cpp b/modules/juce_gui_basics/commands/juce_KeyPressMappingSet.cpp index cebdfe801f..61a10971ed 100644 --- a/modules/juce_gui_basics/commands/juce_KeyPressMappingSet.cpp +++ b/modules/juce_gui_basics/commands/juce_KeyPressMappingSet.cpp @@ -227,7 +227,7 @@ bool KeyPressMappingSet::restoreFromXml (const XmlElement& xmlVersion) clearAllKeyPresses(); } - forEachXmlChildElement (xmlVersion, map) + for (auto* map : xmlVersion.getChildIterator()) { const CommandID commandId = map->getStringAttribute ("commandId").getHexValue32(); diff --git a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp index 867a5c39e4..d7ea9d45c8 100644 --- a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp +++ b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp @@ -46,7 +46,7 @@ public: template bool applyOperationToChildWithID (const String& id, OperationType& op) const { - forEachXmlChildElement (*xml, e) + for (auto* e : xml->getChildIterator()) { XmlPath child (e, this); @@ -462,7 +462,7 @@ private: //============================================================================== void parseSubElements (const XmlPath& xml, DrawableComposite& parentDrawable, bool shouldParseClip = true) { - forEachXmlChildElement (*xml, e) + for (auto* e : xml->getChildIterator()) { const XmlPath child (xml.getChild (e)); @@ -830,7 +830,7 @@ private: if (fillXml.xml != nullptr) { - forEachXmlChildElementWithTagName (*fillXml, e, "stop") + for (auto* e : fillXml->getChildWithTagNameIterator ("stop")) { auto col = parseColour (fillXml.getChild (e), "stop-color", Colours::black); @@ -1080,7 +1080,7 @@ private: auto dc = new DrawableComposite(); setCommonAttributes (*dc, xml); - forEachXmlChildElement (*xml, e) + for (auto* e : xml->getChildIterator()) { if (e->isTextElement()) { diff --git a/modules/juce_gui_basics/properties/juce_PropertyPanel.cpp b/modules/juce_gui_basics/properties/juce_PropertyPanel.cpp index ab207c4da4..b9a3aff2ae 100644 --- a/modules/juce_gui_basics/properties/juce_PropertyPanel.cpp +++ b/modules/juce_gui_basics/properties/juce_PropertyPanel.cpp @@ -367,7 +367,7 @@ void PropertyPanel::restoreOpennessState (const XmlElement& xml) { auto sections = getSectionNames(); - forEachXmlChildElementWithTagName (xml, e, "SECTION") + for (auto* e : xml.getChildWithTagNameIterator ("SECTION")) { setSectionOpen (sections.indexOf (e->getStringAttribute ("name")), e->getBoolAttribute ("open")); diff --git a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp index 0309219f4f..1ef18057c5 100644 --- a/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp +++ b/modules/juce_gui_basics/widgets/juce_TableHeaderComponent.cpp @@ -439,7 +439,7 @@ void TableHeaderComponent::restoreFromString (const String& storedVersion) { int index = 0; - forEachXmlChildElement (*storedXML, col) + for (auto* col : storedXML->getChildIterator()) { auto tabId = col->getIntAttribute ("id"); diff --git a/modules/juce_gui_basics/widgets/juce_TreeView.cpp b/modules/juce_gui_basics/widgets/juce_TreeView.cpp index b6d4d1cc6c..d439122283 100644 --- a/modules/juce_gui_basics/widgets/juce_TreeView.cpp +++ b/modules/juce_gui_basics/widgets/juce_TreeView.cpp @@ -646,7 +646,7 @@ void TreeView::restoreOpennessState (const XmlElement& newState, const bool rest { clearSelectedItems(); - forEachXmlChildElementWithTagName (newState, e, "SELECTED") + for (auto* e : newState.getChildWithTagNameIterator ("SELECTED")) if (auto* item = rootItem->findItemFromIdentifierString (e->getStringAttribute ("id"))) item->setSelected (true, false); } @@ -1834,7 +1834,7 @@ void TreeViewItem::restoreOpennessState (const XmlElement& e) Array items; items.addArray (subItems); - forEachXmlChildElement (e, n) + for (auto* n : e.getChildIterator()) { auto id = n->getStringAttribute ("id");