diff --git a/pxr/base/lib/plug/plugin.cpp b/pxr/base/lib/plug/plugin.cpp index b34cd6e1e6..8c815ca86c 100644 --- a/pxr/base/lib/plug/plugin.cpp +++ b/pxr/base/lib/plug/plugin.cpp @@ -314,8 +314,8 @@ PlugPlugin::_LoadWithDependents(_SeenPlugins *seenPlugins) // Load any dependencies. JsObject dependencies = GetDependencies(); - TF_FOR_ALL(i, dependencies) { - string baseTypeName = i->first; + for (const auto& p : dependencies) { + string baseTypeName = p.first; TfType baseType = TfType::FindByName(baseTypeName); // Check that each base class type is defined. @@ -327,15 +327,14 @@ PlugPlugin::_LoadWithDependents(_SeenPlugins *seenPlugins) // Get dependencies, as typenames typedef vector TypeNames; - if (!i->second.IsArrayOf()) { + if (!p.second.IsArrayOf()) { TF_CODING_ERROR("Load failed: dependency list has wrong type"); return false; } - const TypeNames & dependents = i->second.GetArrayOf(); + const TypeNames & dependents = p.second.GetArrayOf(); // Load the dependencies for each base class. - TF_FOR_ALL(j, dependents) { - const string & dependName = *j; + for (const auto& dependName : dependents) { TfType dependType = TfType::FindByName(dependName); if (dependType.IsUnknown()) { @@ -472,8 +471,8 @@ PlugPlugin::_GetAllPlugins() std::lock_guard lock(_allPluginsMutex); PlugPluginPtrVector plugins; plugins.reserve(_allPlugins->size()); - TF_FOR_ALL(it, *_allPlugins) { - plugins.push_back(it->second); + for (const auto& p : *_allPlugins) { + plugins.push_back(p.second); } return plugins; } @@ -517,8 +516,8 @@ PlugPlugin::DeclaresType(const TfType& type, bool includeSubclasses) const if (const JsValue* typesEntry = TfMapLookupPtr(_dict, "Types")) { if (typesEntry->IsObject()) { const JsObject& typesDict = typesEntry->GetJsObject(); - TF_FOR_ALL(it, typesDict) { - const TfType typeFromPlugin = TfType::FindByName(it->first); + for (const auto& p : typesDict) { + const TfType typeFromPlugin = TfType::FindByName(p.first); const bool match = (includeSubclasses ? typeFromPlugin.IsA(type) : (typeFromPlugin == type)); @@ -562,16 +561,15 @@ PlugPlugin::_DeclareAliases( TfType t, const JsObject & metadata ) const JsObject& aliasDict = i->second.GetJsObject(); - TF_FOR_ALL(aliasIt, aliasDict) { - - if (!aliasIt->second.IsString()) { + for (const auto& p : aliasDict) { + if (!p.second.IsString()) { TF_WARN("Expected string for alias name, but found %s", - aliasIt->second.GetTypeName().c_str() ); + p.second.GetTypeName().c_str() ); continue; } - const string& aliasName = aliasIt->second.GetString(); - TfType aliasBase = TfType::Declare(aliasIt->first); + const string& aliasName = p.second.GetString(); + TfType aliasBase = TfType::Declare(p.first); t.AddAlias( aliasBase, aliasName ); } @@ -586,9 +584,9 @@ PlugPlugin::_DeclareTypes() const JsObject& types = typesValue.GetJsObject(); // Declare TfTypes for all the types found in the plugin. - TF_FOR_ALL(i, types) { - if (i->second.IsObject()) { - _DeclareType(i->first, i->second.GetJsObject()); + for (const auto& p : types) { + if (p.second.IsObject()) { + _DeclareType(p.first, p.second.GetJsObject()); } } } @@ -633,15 +631,15 @@ PlugPlugin::_DeclareType( } else { // Make sure that the bases mentioned in the plugin // metadata are among them. - TF_FOR_ALL(i, basesVec) { - TfType base = *i; + for (const auto& base : basesVec) { std::string const &baseName = base.GetTypeName(); if (std::find(existingBases.begin(), existingBases.end(), base) == existingBases.end()) { // Our expected base was not found. std::string basesStr; - TF_FOR_ALL(j, existingBases) - basesStr += j->GetTypeName() + " "; + for (const auto& j : existingBases) { + basesStr += j.GetTypeName() + " "; + } TF_CODING_ERROR( "The metadata for plugin '%s' defined in %s declares " "type '%s' with base type '%s', but the type has " diff --git a/pxr/base/lib/plug/testenv/testPlugPixver.cpp b/pxr/base/lib/plug/testenv/testPlugPixver.cpp index 3121897152..cdffd5d053 100644 --- a/pxr/base/lib/plug/testenv/testPlugPixver.cpp +++ b/pxr/base/lib/plug/testenv/testPlugPixver.cpp @@ -76,10 +76,10 @@ int main(int argc, char* argv[]) // Print out the paths so we can compare runs when something fails cout << "==== paths ====" << endl; sort(paths.begin(), paths.end()); - TF_FOR_ALL(it, paths) { - cout << *it << endl; - if (IsPathToCheck(*it)) { - filtered_paths.push_back(*it); + for (const auto& path : paths) { + cout << path << endl; + if (IsPathToCheck(path)) { + filtered_paths.push_back(path); } } cout << endl; diff --git a/pxr/base/lib/plug/wrapPlugin.cpp b/pxr/base/lib/plug/wrapPlugin.cpp index c0a91cd30e..fd652a9f4f 100644 --- a/pxr/base/lib/plug/wrapPlugin.cpp +++ b/pxr/base/lib/plug/wrapPlugin.cpp @@ -28,7 +28,6 @@ #include "pxr/base/tf/pyContainerConversions.h" #include "pxr/base/tf/pyPtrHelpers.h" #include "pxr/base/tf/pyResultConversions.h" -#include "pxr/base/tf/iterator.h" #include #include @@ -45,9 +44,9 @@ static dict _ConvertDict( const JsObject & dictionary ) { dict result; - TF_FOR_ALL(i, dictionary) { - const string & key = i->first; - const JsValue & val = i->second; + for (const auto& p : dictionary) { + const string & key = p.first; + const JsValue & val = p.second; result[key] = JsConvertToContainerType(val); }