From 5b989c653dee7816d4db0e85ea3128a040da4713 Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:51:17 -0800 Subject: [PATCH 01/10] MessageHandler : Add `msg()` overload accepting `fmt::format_string` --- Changes | 10 ++++++++++ SConstruct | 3 ++- include/IECore/MessageHandler.h | 8 ++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 692200ee43..01dbda907f 100644 --- a/Changes +++ b/Changes @@ -3,6 +3,16 @@ +API +--- + +- MessageHandler : Added `msg()` overload that accepts a `fmt::format_string` and arguments. + +Build +----- + +- Requires `fmt` 9.1.0. + 10.7.0.0a4 (relative to 10.7.0.0a3) ========== diff --git a/SConstruct b/SConstruct index 31e8e5da62..645d0fc0e6 100644 --- a/SConstruct +++ b/SConstruct @@ -1141,7 +1141,8 @@ env.Append( LIBS = [ "OpenEXR" + env["OPENEXR_LIB_SUFFIX"], # Link Windows zlib against static library to avoid potential conflicts # with system provided version. - "z" if env["PLATFORM"] != "win32" else "zlibstatic" + "z" if env["PLATFORM"] != "win32" else "zlibstatic", + "fmt" ] ) diff --git a/include/IECore/MessageHandler.h b/include/IECore/MessageHandler.h index 058c8d5f05..ec4889066e 100644 --- a/include/IECore/MessageHandler.h +++ b/include/IECore/MessageHandler.h @@ -41,6 +41,8 @@ #include "boost/format.hpp" #include "boost/noncopyable.hpp" +#include "fmt/format.h" + #include namespace IECore @@ -155,6 +157,12 @@ typedef MessageHandler Msg; /// for brevity. IECORE_API void msg( MessageHandler::Level level, const std::string &context, const std::string &message ); IECORE_API void msg( MessageHandler::Level level, const std::string &context, const boost::format &message ); +/// Inline templated convenience function which formats the message using the provided arguments. +template +inline void msg( MessageHandler::Level level, const std::string &context, fmt::format_string message, Args&&... args ) +{ + msg( level, context, fmt::format( message, std::forward( args )... ) ); +} }; // namespace IECore From 0fa93a418fbd4254577df9cf342fa480dbe9f0fc Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:51:57 -0800 Subject: [PATCH 02/10] InternedString : Add specialised `fmt::formatter` --- Changes | 3 +-- include/IECore/InternedString.inl | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 01dbda907f..d95afdf26f 100644 --- a/Changes +++ b/Changes @@ -1,12 +1,11 @@ 10.7.x.x (relative to 10.7.0.0a4) ======== - - API --- - MessageHandler : Added `msg()` overload that accepts a `fmt::format_string` and arguments. +- InternedString : Added specialisation for `fmt::formatter`. Build ----- diff --git a/include/IECore/InternedString.inl b/include/IECore/InternedString.inl index 3e1af10c3c..02d67e88ca 100644 --- a/include/IECore/InternedString.inl +++ b/include/IECore/InternedString.inl @@ -35,6 +35,8 @@ #ifndef IECORE_INTERNEDSTRING_INL #define IECORE_INTERNEDSTRING_INL +#include + namespace IECore { @@ -137,4 +139,11 @@ struct hash } // namespace std +namespace fmt +{ + +template <> struct formatter : ostream_formatter { }; + +} // namespace fmt + #endif // IECORE_INTERNEDSTRING_INL From bed0164b0494a1ec439849b2f48e08d23a4ec924 Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:53:44 -0800 Subject: [PATCH 03/10] IECoreAlembic : Prefer fmt::format --- .../include/IECoreAlembic/PrimitiveReader.inl | 20 ++++----- .../src/IECoreAlembic/AlembicScene.cpp | 44 ++++++++----------- .../src/IECoreAlembic/MeshReader.cpp | 10 ++--- .../src/IECoreAlembic/PrimitiveReader.cpp | 5 +-- .../src/IECoreAlembic/PrimitiveWriter.cpp | 2 +- 5 files changed, 34 insertions(+), 47 deletions(-) diff --git a/contrib/IECoreAlembic/include/IECoreAlembic/PrimitiveReader.inl b/contrib/IECoreAlembic/include/IECoreAlembic/PrimitiveReader.inl index e2cab51dbb..8f649206d2 100644 --- a/contrib/IECoreAlembic/include/IECoreAlembic/PrimitiveReader.inl +++ b/contrib/IECoreAlembic/include/IECoreAlembic/PrimitiveReader.inl @@ -103,10 +103,10 @@ void PrimitiveReader::readGeomParam( const T ¶m, const Alembic::Abc::ISample { IECore::msg( IECore::Msg::Warning, "PrimitiveReader::convertArbGeomParam", - boost::format( "GeomParam \"%s\" on object \"%s\" has unsupported array extent %d" ) - % param.getHeader().getName() - % param.getParent().getObject().getFullName() - % param.getArrayExtent() + "GeomParam \"{}\" on object \"{}\" has unsupported array extent {}", + param.getHeader().getName(), + param.getParent().getObject().getFullName(), + param.getArrayExtent() ); return; } @@ -151,13 +151,11 @@ void PrimitiveReader::readGeomParam( const T ¶m, const Alembic::Abc::ISample { IECore::msg( IECore::Msg::Warning, "PrimitiveReader::readGeomParam", - boost::format( - "Ignoring invalid primitive variable \"%s\" on object \"%s\" (size %d, expected %d)" - ) - % primitiveVariableName - % param.getParent().getObject().getFullName() - % (pv.indices ? pv.indices->readable().size() : data->readable().size()) - % primitive->variableSize( pv.interpolation ) + "Ignoring invalid primitive variable \"{}\" on object \"{}\" (size {}, expected {})", + primitiveVariableName, + param.getParent().getObject().getFullName(), + (pv.indices ? pv.indices->readable().size() : data->readable().size()), + primitive->variableSize( pv.interpolation ) ); } } diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp index 5068e48ed3..9da070f488 100644 --- a/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp +++ b/contrib/IECoreAlembic/src/IECoreAlembic/AlembicScene.cpp @@ -63,6 +63,8 @@ #include "tbb/spin_mutex.h" +#include "fmt/format.h" + #include #include @@ -171,7 +173,7 @@ class AlembicScene::AlembicReader : public AlembicIO { // Even though the default policy for IFactory is kThrowPolicy, this appears not to // be applied when it fails to load an archive - instead it returns an invalid archive. - throw IECore::Exception( boost::str( boost::format( "Unable to open file \"%s\"" ) % fileName ) ); + throw IECore::Exception( fmt::format( "Unable to open file \"{}\"", fileName ) ); } } @@ -441,7 +443,7 @@ class AlembicScene::AlembicReader : public AlembicIO IECore::msg( IECore::Msg::Warning, "AlembicScene::readAttributeAtSample", - boost::format( "Unable to read attribute '%1%'" ) % name + "Unable to read attribute '{}'", name ); return nullptr; } @@ -834,7 +836,7 @@ class AlembicScene::AlembicReader : public AlembicIO IECore::msg( IECore::Msg::Warning, "AlembicScene::readAttributeAtSample", - boost::format( "Unsupported attribute type datatype: \"%1%\" extend:%2% interpretation:\"%3%\"" ) % pod % extent % getInterpretation() + "Unsupported attribute type datatype: \"{}\" extent:{} interpretation:\"{}\"", pod, extent, getInterpretation() ); return nullptr; @@ -1464,7 +1466,7 @@ class AlembicScene::AlembicWriter : public AlembicIO } else { - throw IECore::Exception( boost::str( boost::format( "Unsupported data type : '%1%'" ) % transform->typeName() ) ); + throw IECore::Exception( fmt::format( "Unsupported data type : '{}'", transform->typeName() ) ); } if( m_xformSampleTimes.size() && m_xformSampleTimes.back() >= time ) @@ -1536,13 +1538,10 @@ class AlembicScene::AlembicWriter : public AlembicIO { if( !haveXform() ) { - IECore::msg(IECore::MessageHandler::Level::Warning, __func__, - boost::str( - boost::format( "Cannot write attribute ( attribute name: '%1%', attribute type: '%2%', time: %3% ) at root. " ) % - name.string() % - attribute->typeName() % - time - ) + IECore::msg( + IECore::MessageHandler::Level::Warning, __func__, + "Cannot write attribute (attribute name: '{}', attribute type: '{}', time: {}) at root.", + name, attribute->typeName(), time ); return; } @@ -1557,9 +1556,8 @@ class AlembicScene::AlembicWriter : public AlembicIO { IECore::msg( IECore::MessageHandler::Level::Warning, "AlembicScene::writeAttribute", - boost::format( - "Expected BoolData for attribute \"%s\" but got \"%s\"." - ) % name % attribute->typeName() + "Expected BoolData for attribute \"{}\" but got \"{}\".", + name, attribute->typeName() ); } } @@ -1761,17 +1759,11 @@ class AlembicScene::AlembicWriter : public AlembicIO this->path( path ); pathToString( path, pathStr ); IECore::msg( - IECore::Msg::Warning, - "AlembicScene::writeAttribute", - boost::str( - boost::format( "Cannot write attribute ( attribute name: '%1%', attribute type: '%2%', time: %3% ) at location '%4%'. " ) % - name.string() % - attribute->typeName() % - time % - pathStr - ) - ); - + IECore::Msg::Warning, + "AlembicScene::writeAttribute", + "Cannot write attribute (attribute name: '{}', attribute type: '{}', time: {}) at location '{}'.", + name, attribute->typeName(), time, pathStr + ); } } @@ -1801,7 +1793,7 @@ class AlembicScene::AlembicWriter : public AlembicIO IECore::msg( IECore::Msg::Warning, "AlembicScene::writeObject", - boost::format( "Unsupported object type \"%1%\"" ) % object->typeName() + "Unsupported object type \"{}\"", object->typeName() ); return; } diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/MeshReader.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/MeshReader.cpp index b0e49ba740..734b9495fc 100644 --- a/contrib/IECoreAlembic/src/IECoreAlembic/MeshReader.cpp +++ b/contrib/IECoreAlembic/src/IECoreAlembic/MeshReader.cpp @@ -159,12 +159,10 @@ class MeshReader : public PrimitiveReader { IECore::msg( IECore::Msg::Warning, "PrimitiveReader::readGeomParam", - boost::format( - "Ignoring invalid \"uv\" property on object \"%1%\" (size %2%, expected %3%)" - ) - % uvs.getParent().getObject().getFullName() - % ( indexData ? indexData->readable().size() : uvData->readable().size() ) - % primitive->variableSize( primitiveVariable.interpolation ) + "Ignoring invalid \"uv\" property on object \"{}\" (size {}, expected {})", + uvs.getParent().getObject().getFullName(), + ( indexData ? indexData->readable().size() : uvData->readable().size() ), + primitive->variableSize( primitiveVariable.interpolation ) ); } } diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveReader.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveReader.cpp index e4042c30c3..69b3bf8f7d 100644 --- a/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveReader.cpp +++ b/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveReader.cpp @@ -156,9 +156,8 @@ void PrimitiveReader::readArbGeomParams( const Alembic::Abc::ICompoundProperty & { msg( Msg::Warning, "PrimitiveReader::convertArbGeomParams", - boost::format( "GeomParam \"%s\" on object \"%s\" has unsupported type" ) - % header.getName() - % params.getObject().getFullName() + "GeomParam \"{}\" on object \"{}\" has unsupported type", + header.getName(), params.getObject().getFullName() ); } } diff --git a/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveWriter.cpp b/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveWriter.cpp index 46cefa4b7a..7d69f87c8a 100644 --- a/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveWriter.cpp +++ b/contrib/IECoreAlembic/src/IECoreAlembic/PrimitiveWriter.cpp @@ -199,7 +199,7 @@ void PrimitiveWriter::writeArbGeomParams( const IECoreScene::Primitive *primitiv } break; default : - IECore::msg( IECore::Msg::Warning, "PrimitiveWriter::writeArbGeomParams", boost::format( "Variable \"%1%\" has unsupported type \"%2%" ) % p.first % p.second.data->typeName() ); + IECore::msg( IECore::Msg::Warning, "PrimitiveWriter::writeArbGeomParams", "Variable \"{}\" has unsupported type \"{}\"", p.first, p.second.data->typeName() ); break; } } From 2ca49ed61cfa1a41bfcf6c9e0884f494ba04fa46 Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:53:56 -0800 Subject: [PATCH 04/10] IECoreUSD : Prefer fmt::format While a win overall, the need to pepper calls to `GetString()` and `GetAsString()` everywhere for TfToken et al is a bit unfortunate. We could look at `format_as` once we're on a more modern version of `fmt`. --- .../IECoreUSD/src/IECoreUSD/CameraAlgo.cpp | 12 ++---- .../IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp | 4 +- .../IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp | 10 +++-- .../src/IECoreUSD/SceneCacheData.cpp | 42 ++++++++++--------- .../src/IECoreUSD/SceneCacheFileFormat.cpp | 8 ++-- .../SdfFileFormatSharedSceneWriters.cpp | 2 +- .../IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp | 10 ++--- contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp | 19 +++++---- 8 files changed, 54 insertions(+), 53 deletions(-) diff --git a/contrib/IECoreUSD/src/IECoreUSD/CameraAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/CameraAlgo.cpp index 677c4b25d8..dedc3f4f72 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/CameraAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/CameraAlgo.cpp @@ -91,10 +91,8 @@ IECore::ObjectPtr readCamera( pxr::UsdGeomCamera &camera, pxr::UsdTimeCode time, { IECore::msg( IECore::Msg::Warning, "IECoreUSD::CameraAlgo", - boost::format( "Unsupported projection \"%1%\" reading \"%2%\" at time %3%" ) - % projection - % camera.GetPrim().GetPath() - % ( time.GetValue() / camera.GetPrim().GetStage()->GetTimeCodesPerSecond() ) + "Unsupported projection \"{}\" reading \"{}\" at time {}", + projection.GetString(), camera.GetPrim().GetPath().GetAsString(), ( time.GetValue() / camera.GetPrim().GetStage()->GetTimeCodesPerSecond() ) ); } @@ -182,10 +180,8 @@ bool writeCamera( const IECoreScene::Camera *camera, const pxr::UsdStagePtr &sta { IECore::msg( IECore::Msg::Warning, "IECoreUSD::CameraAlgo", - boost::format( "Unsupported projection \"%1%\" writing \"%2%\" at time %3%" ) - % camera->getProjection() - % path - % ( time.GetValue() / stage->GetTimeCodesPerSecond() ) + "Unsupported projection \"{}\" writing \"{}\" at time {}", + camera->getProjection(), path.GetAsString(), ( time.GetValue() / stage->GetTimeCodesPerSecond() ) ); } diff --git a/contrib/IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp index a92ca29dd5..5dd263281d 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/CurvesAlgo.cpp @@ -110,7 +110,7 @@ IECore::ObjectPtr readBasisCurves( pxr::UsdGeomBasisCurves &curves, pxr::UsdTime } else { - IECore::msg( IECore::Msg::Warning, "USDScene", boost::format( "Unsupported basis \"%1%\"" ) % usdBasis ); + IECore::msg( IECore::Msg::Warning, "USDScene", "Unsupported basis \"{}\"", usdBasis.GetString() ); } } @@ -125,7 +125,7 @@ IECore::ObjectPtr readBasisCurves( pxr::UsdGeomBasisCurves &curves, pxr::UsdTime } else if( wrap != pxr::UsdGeomTokens->nonperiodic ) { - IECore::msg( IECore::Msg::Warning, "USDScene", boost::format( "Unsupported wrap \"%1%\"" ) % wrap ); + IECore::msg( IECore::Msg::Warning, "USDScene", "Unsupported wrap \"{}\"", wrap.GetString() ); } return readCurves( curves, time, basis, periodic, canceller ); diff --git a/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp index 8d223d7b39..edc00ff166 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/PrimitiveAlgo.cpp @@ -56,6 +56,8 @@ IECORE_PUSH_DEFAULT_VISIBILITY #include "pxr/usd/usdSkel/utils.h" IECORE_POP_DEFAULT_VISIBILITY +#include "fmt/ostream.h" + using namespace std; using namespace pxr; using namespace IECore; @@ -75,7 +77,7 @@ void IECoreUSD::PrimitiveAlgo::writePrimitiveVariable( const IECoreScene::Primit } else { - IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Invalid Interpolation for %1%" ) % primVar.GetPrimvarName() ); + IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "Invalid Interpolation for {}", primVar.GetPrimvarName().GetString() ); } if ( usdInterpolation == pxr::UsdGeomTokens->constant ) @@ -215,7 +217,7 @@ void addPrimitiveVariableIfValid( IECoreScene::Primitive *primitive, const std:: { if( !primitive->isPrimitiveVariableValid( primitiveVariable ) ) { - IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Ignoring invalid primitive variable \"%1%\"" ) % source.GetPath().GetAsString() ); + IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "Ignoring invalid primitive variable \"{}\"", source.GetPath().GetAsString() ); return; } @@ -227,7 +229,7 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode IECoreScene::PrimitiveVariable::Interpolation interpolation = IECoreUSD::PrimitiveAlgo::fromUSD( primVar.GetInterpolation() ); if( interpolation == IECoreScene::PrimitiveVariable::Invalid ) { - IECore::msg(IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "Invalid Interpolation on %1%" ) % primVar.GetName().GetString() ); + IECore::msg(IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "Invalid Interpolation on {}", primVar.GetName().GetString() ); return; } @@ -243,7 +245,7 @@ void readPrimitiveVariable( const pxr::UsdGeomPrimvar &primVar, pxr::UsdTimeCode ); if( !data ) { - IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", boost::format( "PrimVar: %1% type: %2% not supported - skipping" ) % primVar.GetName().GetString() % primVar.GetTypeName() ); + IECore::msg( IECore::MessageHandler::Level::Warning, "IECoreUSD::PrimitiveAlgo", "PrimVar: {} type: {} not supported - skipping", primVar.GetName().GetString(), fmt::streamed( primVar.GetTypeName() ) ); return; } diff --git a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp index bc03f94f86..9ed01c096c 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheData.cpp @@ -66,6 +66,8 @@ #include "boost/algorithm/string/erase.hpp" #include "boost/algorithm/string/predicate.hpp" +#include "fmt/format.h" + #include using namespace IECore; @@ -89,7 +91,7 @@ const InternedString g_curvesType( "ObjectType:CurvesPrimitive" ); static const TfToken g_curves( "BasisCurves" ); static const TfToken g_xform( "Xform" ); const InternedString g_pointPrimVar( "P" ); -static const TfToken g_NormalsIndicesPrimVar( boost::str( boost::format( "%s:indices" ) % UsdGeomTokens->normals ) ); +static const TfToken g_NormalsIndicesPrimVar( fmt::format( "{}:indices", UsdGeomTokens->normals.GetString() ) ); const InternedString g_normalPrimVar( "N" ); const InternedString g_uvPrimVar( "uv" ); const InternedString g_csPrimVar( "Cs" ); @@ -620,7 +622,7 @@ void SceneCacheData::loadAttributes( const SceneInterface::Path& currentPath, Tf auto timeSamplesIO = attributeIO->subdirectory( g_firstTimeSample, IndexedIO::MissingBehaviour::NullIfMissing ); if ( !timeSamplesIO ) { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", boost::format( "Unable to find time samples for attribute \"%s\" at location \"%s\"." ) % attr % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", "Unable to find time samples for attribute \"{}\" at location \"{}\".", attr, primPath.GetAsString() ); continue; } @@ -628,7 +630,7 @@ void SceneCacheData::loadAttributes( const SceneInterface::Path& currentPath, Tf std::string dataTypeValue; if( !timeSamplesIO->hasEntry( g_ioType ) ) { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", boost::format( "Unable to find data type directory for attribute \"%s\" at location \"%s\"." ) % attr % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", "Unable to find data type directory for attribute \"{}\" at location \"{}\".", attr, primPath.GetAsString() ); continue; } timeSamplesIO->read( g_ioType, dataTypeValue ); @@ -655,10 +657,10 @@ void SceneCacheData::loadAttributes( const SceneInterface::Path& currentPath, Tf } else { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", boost::format( "Unable to convert to USD data type for attribute \"%s\" at location \"%s\"." ) % attr % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadAttributes", "Unable to convert to USD data type for attribute \"{}\" at location \"{}\".", attr, primPath.GetAsString() ); continue; } - + addProperty( properties, primPath, @@ -715,7 +717,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo TfToken usdInterpolation; if ( !variableIO || !variableIO->hasEntry( g_ioInterpolation ) ) { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", boost::format( "Unable to find interpolation for Primitive Variable \"%s\" at location \"%s\"." ) % var % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", "Unable to find interpolation for Primitive Variable \"{}\" at location \"{}\".", var, primPath.GetAsString() ); continue; } @@ -725,7 +727,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo // data type if( !variableIO->hasEntry( g_ioData ) ) { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", boost::format( "Unable to find data for Primitive Variable \"%s\" at location \"%s\"." ) % var % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", "Unable to find data for Primitive Variable \"{}\" at location \"{}\".", var, primPath.GetAsString() ); continue; } @@ -735,7 +737,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo { if( dataEntry.dataType() != IndexedIO::InternedStringArray ) { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", boost::format( "Unable to find reference to data for Primitive Variable \"%s\" at location \"%s\"." ) % var % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", "Unable to find reference to data for Primitive Variable \"{}\" at location \"{}\".", var, primPath.GetAsString() ); continue; } // IECore::Object has saved a reference to the data, so we need to follow the link to the referenced @@ -753,7 +755,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo if( !dataIO || !dataIO->hasEntry( g_ioType ) ) { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", boost::format( "Unable to find data type for Primitive Variable \"%s\" at location \"%s\"." ) % var % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", "Unable to find data type for Primitive Variable \"{}\" at location \"{}\".", var, primPath.GetAsString() ); continue; } @@ -805,7 +807,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo } else { - primVarName = TfToken( boost::str( boost::format( "primvars:%s" ) % var ) ); + primVarName = TfToken( fmt::format( "primvars:{}", var ) ); auto object = Object::create( dataTypeValue ); if( auto data = runTimeCast( object.get() ) ) { @@ -823,7 +825,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo } else { - IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", boost::format( "Unable to find USD data type for Primitive Variable \"%s\" at location \"%s\"." ) % var % primPath ); + IECore::msg( IECore::Msg::Warning, "SceneCacheData::loadPrimVars", "Unable to find USD data type for Primitive Variable \"{}\" at location \"{}\".", var, primPath.GetAsString() ); continue; } } @@ -845,7 +847,7 @@ void SceneCacheData::loadPrimVars( const SceneInterface::Path& currentPath, TfTo // indices if( variableIO && variableIO->hasEntry( g_ioIndices ) ) { - TfToken primVarIndicesName = TfToken( boost::str( boost::format( "%s:indices" ) % primVarName ) ); + TfToken primVarIndicesName = TfToken( fmt::format( "{}:indices", primVarName.GetString() ) ); addProperty( properties, @@ -1159,10 +1161,10 @@ void SceneCacheData::addCollections( SpecData& spec, TfTokenVector& properties, auto safeCollectionName = SceneCacheDataAlgo::toInternalName( collection.first ); // apiSchemas - collectionList.push_back( TfToken( boost::str( boost::format( "CollectionAPI:%s" ) % safeCollectionName ) ) ); + collectionList.push_back( TfToken( fmt::format( "CollectionAPI:{}", safeCollectionName ) ) ); // expansion rule - TfToken expansionRuleName( boost::str( boost::format( "collection:%s:%s" ) % safeCollectionName % g_expansionRule ) ); + TfToken expansionRuleName( fmt::format( "collection:{}:{}", safeCollectionName, g_expansionRule ) ); addProperty( properties, primPath, @@ -1173,9 +1175,9 @@ void SceneCacheData::addCollections( SpecData& spec, TfTokenVector& properties, &UsdTokens->explicitOnly, false ); - + // include relationship - TfToken relationshipName( boost::str( boost::format( "collection:%s:includes" ) % safeCollectionName ) ); + TfToken relationshipName( fmt::format( "collection:{}:includes", safeCollectionName ) ); SdfListOp targetPaths; std::vector targetChildren; @@ -1417,7 +1419,7 @@ VtValue* SceneCacheData::GetMutableFieldValue(const SdfPath &path, const TfToken VtValue SceneCacheData::Get(const SdfPath &path, const TfToken & field) const { - + return GetFieldValue(path, field); } @@ -1478,7 +1480,7 @@ void SceneCacheData::Erase(const SdfPath &path, const TfToken & field) { return; } - + SpecData &spec = i->second; for (size_t j=0, jEnd = spec.fields.size(); j != jEnd; ++j) { @@ -2066,7 +2068,7 @@ void SceneCacheData::SetTimeSample(const SdfPath &path, double time, const VtVal { fieldValue->UncheckedSwap(newSamples); } - + // Insert or overwrite into newSamples. newSamples[time] = value; @@ -2098,7 +2100,7 @@ void SceneCacheData::EraseTimeSample(const SdfPath &path, double time) { return; } - + // Erase from newSamples. newSamples.erase(time); diff --git a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp index b01e0425b7..0a3676f941 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/SceneCacheFileFormat.cpp @@ -177,7 +177,7 @@ bool UsdSceneCacheFileFormat::WriteToFile( const SdfLayer& layer, const std::str outScene = SdfFileFormatSharedSceneWriters::get( filePath ); if ( !outScene ) { - IECore::msg( IECore::Msg::Error, "UsdSceneCacheFileFormat::WriteToFile", boost::format( "Invalid file path \"%s\" for layer \"%s\"." ) % filePath % layer.GetIdentifier() ); + IECore::msg( IECore::Msg::Error, "UsdSceneCacheFileFormat::WriteToFile", "Invalid file path \"{}\" for layer \"{}\".", filePath, layer.GetIdentifier() ); return false; } @@ -262,8 +262,8 @@ void UsdSceneCacheFileFormat::writeLocation( IECore::msg( IECore::Msg::Warning, "SceneCacheFileFormat::writeLocation", - boost::format( "Unsupported multiple reference at location \"%s\", writing only the first reference." ) % primPath - ); + "Unsupported multiple reference at location \"{}\", writing only the first reference.", primPath.GetAsString() + ); } if ( ! references.empty() ) @@ -288,7 +288,7 @@ void UsdSceneCacheFileFormat::writeLocation( IECore::msg( IECore::Msg::Warning, "SceneCacheFileFormat::writeLocation", - boost::format( "Unsupported file extension \"%s\" for reference at location \"%s\"." ) % filePath % primPath + "Unsupported file extension \"{}\" for reference at location \"{}\".", filePath, primPath.GetAsString() ); return; } diff --git a/contrib/IECoreUSD/src/IECoreUSD/SdfFileFormatSharedSceneWriters.cpp b/contrib/IECoreUSD/src/IECoreUSD/SdfFileFormatSharedSceneWriters.cpp index 8ced3db1f3..f11fe1d27b 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/SdfFileFormatSharedSceneWriters.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/SdfFileFormatSharedSceneWriters.cpp @@ -69,7 +69,7 @@ class Cache : public SceneLRUCache } catch ( ... ) { - IECore::msg( IECore::Msg::Error, "SdfFileFormatSharedSceneWriters::SceneLRUCache", boost::format( "Unable to open file path \"%s\" for writing IndexedIo data." ) % fileName ); + IECore::msg( IECore::Msg::Error, "SdfFileFormatSharedSceneWriters::SceneLRUCache", "Unable to open file path \"{}\" for writing IndexedIo data.", fileName ); } cost = 1; return result; diff --git a/contrib/IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp b/contrib/IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp index be8c6eb0ad..49e048f6b4 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/ShaderAlgo.cpp @@ -270,8 +270,8 @@ IECore::InternedString readShaderNetworkWalk( const pxr::SdfPath &anchorPath, co { IECore::msg( IECore::Msg::Warning, "ShaderAlgo", - boost::format( "Input `%1%` has multiple inputs" ) - % i.GetAttr().GetPath() + "Input `{}` has multiple inputs", + i.GetAttr().GetPath().GetAsString() ); } @@ -450,8 +450,8 @@ void writeShaderParameterValues( const IECoreScene::Shader *shader, pxr::UsdShad if( !typeName ) { IECore::msg( IECore::Msg::Warning, "ShaderAlgo", - boost::format( "Shader parameter `%1%.%2%` has unsupported type `%3%`" ) - % shader->getName() % p.first % p.second->typeName() + "Shader parameter `{}.{}` has unsupported type `{}`", + shader->getName(), p.first, p.second->typeName() ); continue; } @@ -663,7 +663,7 @@ void IECoreUSD::ShaderAlgo::writeLight( const IECoreScene::ShaderNetwork *shader !type.IsA() ) { - IECore::msg( IECore::Msg::Warning, "ShaderAlgo::writeLight", boost::format( "Shader `%1%` is not a valid UsdLux light type" ) % outputShader->getName() ); + IECore::msg( IECore::Msg::Warning, "ShaderAlgo::writeLight", "Shader `{}` is not a valid UsdLux light type", outputShader->getName() ); return; } diff --git a/contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp b/contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp index 6df62897ed..9a6177fdfc 100644 --- a/contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp +++ b/contrib/IECoreUSD/src/IECoreUSD/USDScene.cpp @@ -82,11 +82,12 @@ IECORE_POP_DEFAULT_VISIBILITY #include "boost/algorithm/string/predicate.hpp" #include "boost/algorithm/string/replace.hpp" #include "boost/algorithm/string/split.hpp" -#include "boost/format.hpp" #include "boost/functional/hash.hpp" #include "tbb/concurrent_hash_map.h" +#include "fmt/format.h" + #include #include #include @@ -205,7 +206,7 @@ T *reportedCast( const IECore::RunTimeTyped *v, const char *context, const char return t; } - IECore::msg( IECore::Msg::Warning, context, boost::format( "Expected %s but got %s for \"%s\"." ) % T::staticTypeName() % v->typeName() % name ); + IECore::msg( IECore::Msg::Warning, context, "Expected {} but got {} for \"{}\".", T::staticTypeName(), v->typeName(), name ); return nullptr; } @@ -347,8 +348,8 @@ IECore::PathMatcher localSet( const pxr::UsdPrim &prim, const pxr::TfToken &name { IECore::msg( IECore::Msg::Level::Warning, "USDScene", - boost::format( "Ignoring path \"%1%\" in collection \"%2%\" because it is not beneath the collection root \"%3%\"" ) % - path % collection.GetName() % prim.GetPath() + "Ignoring path \"{}\" in collection \"{}\" because it is not beneath the collection root \"{}\"", + path.GetAsString(), collection.GetName().GetString(), prim.GetPath().GetAsString() ); } } @@ -877,7 +878,7 @@ class USDScene::IO : public RefCounted if( !stage ) { - throw IECore::Exception( boost::str( boost::format( "USDScene : Failed to open USD stage : '%1%'" ) % fileName ) ); + throw IECore::Exception( fmt::format( "USDScene : Failed to open USD stage : '{}'", fileName ) ); } return stage; } @@ -973,7 +974,7 @@ USDScene::~USDScene() { IECore::msg( IECore::Msg::Error, "USDScene::~USDScene", - boost::format( "Failed to write shaders with exception \"%1%\"" ) % e.what() + "Failed to write shaders with exception \"{}\"", e.what() ); } } @@ -1337,7 +1338,7 @@ void USDScene::writeAttribute( const SceneInterface::Name &name, const Object *a { IECore::msg( IECore::Msg::Warning, "USDScene::writeAttribute", - boost::format( "Unable to write kind \"%1%\" to \"%2%\"" ) % data->readable() % m_location->prim.GetPath() + "Unable to write kind \"{}\" to \"{}\"", data->readable(), m_location->prim.GetPath().GetAsString() ); } } @@ -1359,7 +1360,7 @@ void USDScene::writeAttribute( const SceneInterface::Name &name, const Object *a // `writeObject()` having been called first to get a suitable concrete type in place. IECore::msg( IECore::Msg::Warning, "USDScene::writeAttribute", - boost::format( "Unable to write attribute \"%1%\" to \"%2%\", because it is not a Gprim" ) % name % m_location->prim.GetPath() + "Unable to write attribute \"{}\" to \"{}\", because it is not a Gprim", name, m_location->prim.GetPath().GetAsString() ); } } @@ -1548,7 +1549,7 @@ void USDScene::writeObject( const Object *object, double time ) { IECore::msg( IECore::Msg::Warning, "USDScene::writeObject", - boost::format( "Unable to write %1% to \"%2%\" at time %3%" ) % object->typeName() % m_location->prim.GetPath() % time + "Unable to write {} to \"{}\" at time {}", object->typeName(), m_location->prim.GetPath().GetAsString(), time ); } } From 9ad61a9f7c1a090579cbc6651206937998724448 Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:56:57 -0800 Subject: [PATCH 05/10] IECore : Prefer fmt::format --- include/IECore/CompoundData.inl | 10 ++++----- include/IECore/CompoundObject.inl | 14 ++++++------ include/IECore/DataAlgo.inl | 6 +++-- include/IECore/DespatchTypedData.h | 2 -- include/IECore/DespatchTypedData.inl | 2 +- include/IECore/IFFFile.h | 2 ++ include/IECore/IFFFile.inl | 6 ++--- include/IECore/LensModel.h | 2 -- include/IECore/Spline.inl | 4 ++-- include/IECore/Version.h | 2 -- src/IECore/CachedReader.cpp | 5 +++-- src/IECore/CompoundParameter.cpp | 9 ++++---- src/IECore/DataCastOp.cpp | 8 ++++--- src/IECore/DataPromoteOp.cpp | 2 -- src/IECore/Debug.cpp | 4 ++-- src/IECore/FileNameParameter.cpp | 5 +++-- src/IECore/FileSequence.cpp | 8 ++++--- src/IECore/FileSequenceFunctions.cpp | 1 - src/IECore/FrameList.cpp | 4 ++-- src/IECore/FrameRange.cpp | 9 ++++---- src/IECore/HeaderGenerator.cpp | 13 +++++------ src/IECore/IECore.cpp | 2 -- src/IECore/IFFFile.cpp | 2 +- src/IECore/LensModel.cpp | 8 +++++-- src/IECore/MurmurHash.cpp | 9 +++----- src/IECore/Object.cpp | 15 +++++++------ src/IECore/ObjectVector.cpp | 5 +++-- src/IECore/RunTimeTyped.cpp | 8 +++---- src/IECore/StreamIndexedIO.cpp | 33 ++++++++++++++-------------- src/IECore/Timer.cpp | 2 +- src/IECore/Version.cpp | 6 ++--- 31 files changed, 104 insertions(+), 104 deletions(-) diff --git a/include/IECore/CompoundData.inl b/include/IECore/CompoundData.inl index 54d411d653..2a212f2e97 100644 --- a/include/IECore/CompoundData.inl +++ b/include/IECore/CompoundData.inl @@ -37,7 +37,7 @@ #include "IECore/Exception.h" -#include "boost/format.hpp" +#include "fmt/format.h" namespace IECore { @@ -65,7 +65,7 @@ const T *CompoundData::member( const InternedString &name, bool throwExceptions { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundData child \"%s\" is not of type \"%s\"." ) % name.value() % T::staticTypeName() ) ); + throw Exception( fmt::format( "CompoundData child \"{}\" is not of type \"{}\".", name.value(), T::staticTypeName() ) ); } else { @@ -77,7 +77,7 @@ const T *CompoundData::member( const InternedString &name, bool throwExceptions { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundData has no child named \"%s\"." ) % name.value() ) ); + throw Exception( fmt::format( "CompoundData has no child named \"{}\".", name.value() ) ); } else { @@ -102,7 +102,7 @@ T *CompoundData::member( const InternedString &name, bool throwExceptions, bool { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundData child \"%s\" is not of type \"%s\"." ) % name.value() % T::staticTypeName() ) ); + throw Exception( fmt::format( "CompoundData child \"%s\" is not of type \"%s\".", name.value(), T::staticTypeName() ) ); } else { @@ -120,7 +120,7 @@ T *CompoundData::member( const InternedString &name, bool throwExceptions, bool } else if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundData has no child named \"%s\"." ) % name.value() ) ); + throw Exception( fmt::format( "CompoundData has no child named \"%s\".", name.value() ) ); } else { diff --git a/include/IECore/CompoundObject.inl b/include/IECore/CompoundObject.inl index bb6c3849c0..83b1cd16b1 100644 --- a/include/IECore/CompoundObject.inl +++ b/include/IECore/CompoundObject.inl @@ -37,7 +37,7 @@ #include "IECore/Exception.h" -#include "boost/format.hpp" +#include "fmt/format.h" namespace IECore { @@ -57,7 +57,7 @@ T *CompoundObject::member( const InternedString &name, bool throwExceptions ) { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundObject child \"%s\" is not of type \"%s\"." ) % name.value() % T::staticTypeName() ) ); + throw Exception( fmt::format( "CompoundObject child \"{}\" is not of type \"{}\".", name.value(), T::staticTypeName() ) ); } else { @@ -69,7 +69,7 @@ T *CompoundObject::member( const InternedString &name, bool throwExceptions ) { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundObject has no child named \"%s\"." ) % name.value() ) ); + throw Exception( fmt::format( "CompoundObject has no child named \"{}\".", name.value() ) ); } else { @@ -93,7 +93,7 @@ const T *CompoundObject::member( const InternedString &name, bool throwException { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundObject child \"%s\" is not of type \"%s\"." ) % name.value() % T::staticTypeName() ) ); + throw Exception( fmt::format( "CompoundObject child \"{}\" is not of type \"{}\".", name.value(), T::staticTypeName() ) ); } else { @@ -105,7 +105,7 @@ const T *CompoundObject::member( const InternedString &name, bool throwException { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundObject has no child named \"%s\"." ) % name.value() ) ); + throw Exception( fmt::format( "CompoundObject has no child named \"{}\".", name.value() ) ); } else { @@ -129,7 +129,7 @@ T *CompoundObject::member( const InternedString &name, bool throwExceptions, boo { if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundObject child \"%s\" is not of type \"%s\"." ) % name.value() % T::staticTypeName() ) ); + throw Exception( fmt::format( "CompoundObject child \"{}\" is not of type \"{}\".", name.value(), T::staticTypeName() ) ); } else { @@ -147,7 +147,7 @@ T *CompoundObject::member( const InternedString &name, bool throwExceptions, boo } else if( throwExceptions ) { - throw Exception( boost::str( boost::format( "CompoundObject has no child named \"%s\"." ) % name.value() ) ); + throw Exception( fmt::format( "CompoundObject has no child named \"{}\".", name.value() ) ); } else { diff --git a/include/IECore/DataAlgo.inl b/include/IECore/DataAlgo.inl index d4ecc141ab..c3fb36f17c 100644 --- a/include/IECore/DataAlgo.inl +++ b/include/IECore/DataAlgo.inl @@ -43,6 +43,8 @@ #include "IECore/TransformationMatrixData.h" #include "IECore/VectorTypedData.h" +#include "fmt/format.h" + #include namespace IECore @@ -204,7 +206,7 @@ typename std::invoke_result_t dispatch( Data *data, F &&fu case PathMatcherDataTypeId : return functor( static_cast( data ), std::forward( args )... ); default : - throw InvalidArgumentException( boost::str ( boost::format( "Data has unknown type '%1%' / '%2%' " ) % typeId % data->typeName() ) ); + throw InvalidArgumentException( fmt::format( "Data has unknown type '{}' / '{}'", typeId, data->typeName() ) ); } } @@ -364,7 +366,7 @@ typename std::invoke_result_t dispatch( const Data * case PathMatcherDataTypeId : return functor( static_cast( data ), std::forward( args )... ); default : - throw InvalidArgumentException( boost::str ( boost::format( "Data has unknown type '%1%' / '%2%' " ) % typeId % data->typeName() ) ); + throw InvalidArgumentException( fmt::format( "Data has unknown type '{}' / '{}'", typeId, data->typeName() ) ); } } diff --git a/include/IECore/DespatchTypedData.h b/include/IECore/DespatchTypedData.h index 6b02e86de3..75322cead8 100644 --- a/include/IECore/DespatchTypedData.h +++ b/include/IECore/DespatchTypedData.h @@ -43,8 +43,6 @@ #include "IECore/Data.h" #include "IECore/Exception.h" -#include "boost/format.hpp" - #include namespace IECore diff --git a/include/IECore/DespatchTypedData.inl b/include/IECore/DespatchTypedData.inl index 57068836fe..8ffb1c909a 100644 --- a/include/IECore/DespatchTypedData.inl +++ b/include/IECore/DespatchTypedData.inl @@ -85,7 +85,7 @@ struct DespatchTypedDataExceptionError template void operator()( const T *data, const F& functor ) { - throw InvalidArgumentException( ( boost::format( "Unhandled data of type %s encountered by DespatchTypedData" ) % data->typeName() ).str() ); + throw InvalidArgumentException( fmt::format( "Unhandled data of type {} encountered by DespatchTypedData", data->typeName() ) ); } }; diff --git a/include/IECore/IFFFile.h b/include/IECore/IFFFile.h index 62a02de2d7..aeba776405 100644 --- a/include/IECore/IFFFile.h +++ b/include/IECore/IFFFile.h @@ -42,6 +42,8 @@ IECORE_PUSH_DEFAULT_VISIBILITY #include "Imath/ImathVec.h" IECORE_POP_DEFAULT_VISIBILITY +#include "fmt/format.h" + #include #include diff --git a/include/IECore/IFFFile.inl b/include/IECore/IFFFile.inl index 80e87751ac..e04a6d354b 100644 --- a/include/IECore/IFFFile.inl +++ b/include/IECore/IFFFile.inl @@ -49,7 +49,7 @@ void IFFFile::Chunk::read( T &data ) { if ( sizeof(T) != m_dataSize ) { - msg( Msg::Error, "IFFFile::Chunk::read()", boost::format( "Attempting to read data of size '%d' for a Chunk '%s' with dataSize '%d'." ) % sizeof(T) % m_type.name() % m_dataSize ); + msg( Msg::Error, "IFFFile::Chunk::read()", "Attempting to read data of size '{}' for a Chunk '{}' with dataSize '{}'.", sizeof(T), m_type.name(), m_dataSize ); } T dataBuffer[1]; @@ -65,7 +65,7 @@ size_t IFFFile::Chunk::read( std::vector &data ) if ( sizeof(T) * length != m_dataSize ) { - msg( Msg::Error, "IFFFile::Chunk::read()", boost::format( "Attempting to read '%d' pieces of data of size '%d' for a Chunk '%s' with dataSize '%d'." ) % length % sizeof(T) % m_type.name() % m_dataSize ); + msg( Msg::Error, "IFFFile::Chunk::read()", "Attempting to read '{}' pieces of data of size '{}' for a Chunk '{}' with dataSize '{}'.", length, sizeof(T), m_type.name(), m_dataSize ); } std::vector dataBuffer( length ); @@ -86,7 +86,7 @@ size_t IFFFile::Chunk::read( std::vector > &data ) if ( sizeof(T) * length * 3 != m_dataSize ) { - msg( Msg::Error, "IFFFile::Chunk::read()", boost::format( "Attempting to read %d pieces of IMath::Vec3 data of size %d for a Chunk '%s' with dataSize %d." ) % length % sizeof(T) % m_type.name() % m_dataSize ); + msg( Msg::Error, "IFFFile::Chunk::read()", "Attempting to read {} pieces of IMath::Vec3 data of size {} for a Chunk '{}' with dataSize {}.", length, sizeof(T), m_type.name(), m_dataSize ); } std::vector dataBuffer( length * 3 ); diff --git a/include/IECore/LensModel.h b/include/IECore/LensModel.h index 232fff74b2..2158e522d3 100644 --- a/include/IECore/LensModel.h +++ b/include/IECore/LensModel.h @@ -44,8 +44,6 @@ #include "IECore/SimpleTypedParameter.h" #include "IECore/TypeIds.h" -#include "boost/format.hpp" - #include namespace IECore diff --git a/include/IECore/Spline.inl b/include/IECore/Spline.inl index af415ba8b2..d9dd4e5f40 100644 --- a/include/IECore/Spline.inl +++ b/include/IECore/Spline.inl @@ -39,7 +39,7 @@ #include "Imath/half.h" -#include "boost/format.hpp" +#include "fmt/format.h" namespace IECore { @@ -114,7 +114,7 @@ inline X Spline::solve( X x, typename PointContainer::const_iterator &segme size_t numPoints = points.size(); if( numPoints < coefficientsNeeded ) { - throw( Exception( boost::str( boost::format( "Spline has less than %i points." ) % coefficientsNeeded ) ) ); + throw( Exception( fmt::format( "Spline has less than {} points.", coefficientsNeeded ) ) ); } if( (numPoints - coefficientsNeeded) % basis.step ) { diff --git a/include/IECore/Version.h b/include/IECore/Version.h index 765919bca3..121f8425e8 100644 --- a/include/IECore/Version.h +++ b/include/IECore/Version.h @@ -37,8 +37,6 @@ #include "IECore/Export.h" -#include "boost/format.hpp" - #include #define CORTEX_MILESTONE_VERSION IE_CORE_MILESTONEVERSION diff --git a/src/IECore/CachedReader.cpp b/src/IECore/CachedReader.cpp index 7045bc3b02..1695d29d64 100644 --- a/src/IECore/CachedReader.cpp +++ b/src/IECore/CachedReader.cpp @@ -39,11 +39,12 @@ #include "IECore/Object.h" #include "IECore/Reader.h" -#include "boost/format.hpp" #include "boost/lexical_cast.hpp" #include "tbb/concurrent_hash_map.h" +#include "fmt/format.h" + #include // Windows defines SearchPath @@ -111,7 +112,7 @@ struct CachedReader::MemberData FileErrors::const_accessor cit; if ( data->m_fileErrors.find( cit, filePath ) ) { - throw Exception( ( format( "Previous attempt to read %s failed: %s" ) % filePath % cit->second ).str() ); + throw Exception( fmt::format( "Previous attempt to read {} failed: {}", filePath, cit->second ) ); } } diff --git a/src/IECore/CompoundParameter.cpp b/src/IECore/CompoundParameter.cpp index 09123cd182..95187ab492 100644 --- a/src/IECore/CompoundParameter.cpp +++ b/src/IECore/CompoundParameter.cpp @@ -37,9 +37,10 @@ #include "IECore/Exception.h" #include "IECore/NullObject.h" -#include "boost/format.hpp" #include "boost/lexical_cast.hpp" +#include "fmt/format.h" + #include using namespace std; @@ -230,7 +231,7 @@ bool CompoundParameter::valueValid( const Object *value, std::string *reason ) c { if( reason ) { - *reason = boost::str( boost::format( "Value is of type \"%s\" and not of type \"CompoundObject\"." ) % value->typeName() ); + *reason = fmt::format( "Value is of type \"{}\" and not of type \"CompoundObject\".", value->typeName() ); } return false; } @@ -281,7 +282,7 @@ void CompoundParameter::addParameter( ParameterPtr parameter ) { if( m_namesToParameters.find( parameter->internedName() )!=m_namesToParameters.end() ) { - throw Exception( boost::str( boost::format( "Child parameter named \"%s\" already exists." ) % parameter->name() ) ); + throw Exception( fmt::format( "Child parameter named \"{}\" already exists.", parameter->name() ) ); } m_namesToParameters.insert( ParameterMap::value_type( parameter->internedName(), parameter ) ); m_parameters.push_back( parameter ); @@ -291,7 +292,7 @@ void CompoundParameter::insertParameter( ParameterPtr parameter, ConstParameterP { if( m_namesToParameters.find( parameter->internedName() )!=m_namesToParameters.end() ) { - throw Exception( boost::str( boost::format( "Child parameter named \"%s\" already exists." ) % parameter->name() ) ); + throw Exception( fmt::format( "Child parameter named \"{}\" already exists.", parameter->name() ) ); } ParameterVector::iterator it = find( m_parameters.begin(), m_parameters.end(), other ); if( it==m_parameters.end() ) diff --git a/src/IECore/DataCastOp.cpp b/src/IECore/DataCastOp.cpp index b67ebb8f71..63f5ed60dd 100644 --- a/src/IECore/DataCastOp.cpp +++ b/src/IECore/DataCastOp.cpp @@ -43,7 +43,7 @@ #include "IECore/TransformationMatrixData.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" +#include "fmt/format.h" #include @@ -724,7 +724,9 @@ ObjectPtr DataCastOp::doOperation( const CompoundObject * operands ) string targetTypeName = Object::typeNameFromTypeId( targetType ); if ( targetTypeName == "" ) - targetTypeName = ( format( "%d" ) % targetType ).str(); + { + targetTypeName = fmt::format( "{}", fmt::underlying( targetType ) ); + } - throw Exception( string("Don't know how to convert from type ") + data->typeName() + " to " + targetTypeName ); + throw Exception( fmt::format( "Don't know how to convert from type {} to {}", data->typeName(), targetTypeName ) ); } diff --git a/src/IECore/DataPromoteOp.cpp b/src/IECore/DataPromoteOp.cpp index f3d664df48..c968790d46 100644 --- a/src/IECore/DataPromoteOp.cpp +++ b/src/IECore/DataPromoteOp.cpp @@ -43,8 +43,6 @@ #include "IECore/SimpleTypedData.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - #include using namespace IECore; diff --git a/src/IECore/Debug.cpp b/src/IECore/Debug.cpp index b079c3de6e..4563de2e91 100644 --- a/src/IECore/Debug.cpp +++ b/src/IECore/Debug.cpp @@ -32,7 +32,7 @@ // ////////////////////////////////////////////////////////////////////////// -#include "boost/format.hpp" +#include "fmt/format.h" #include #include @@ -67,7 +67,7 @@ void waitForDebugger() #else const int pid = _getpid(); #endif - std::cerr << ( boost::format( "Attach debugger here and set gDebuggerLock (%p) variable to false. pid: %i" ) % &gDebuggerLock % pid ).str() << std::endl; + std::cerr << fmt::format( "Attach debugger here and set gDebuggerLock ({}) variable to false. pid: {}", fmt::ptr( &gDebuggerLock ), pid ) << std::endl; while( gDebuggerLock ) { std::this_thread::sleep_for( std::chrono::milliseconds( 100 ) ); diff --git a/src/IECore/FileNameParameter.cpp b/src/IECore/FileNameParameter.cpp index 7dbbee2657..d3fa387f72 100644 --- a/src/IECore/FileNameParameter.cpp +++ b/src/IECore/FileNameParameter.cpp @@ -40,7 +40,8 @@ #include "boost/algorithm/string/classification.hpp" #include "boost/algorithm/string/split.hpp" #include "boost/filesystem/operations.hpp" -#include "boost/format.hpp" + +#include "fmt/format.h" #include @@ -103,7 +104,7 @@ bool FileNameParameter::valueValid( const Object *value, std::string *reason ) c { if( reason ) { - *reason = ( boost::format( "Filename extension '%s' not valid" ) % ext ).str(); + *reason = fmt::format( "Filename extension '{}' not valid", ext ); } return false; } diff --git a/src/IECore/FileSequence.cpp b/src/IECore/FileSequence.cpp index 06c1047519..c04a5ecfc2 100644 --- a/src/IECore/FileSequence.cpp +++ b/src/IECore/FileSequence.cpp @@ -41,6 +41,8 @@ #include "boost/lexical_cast.hpp" #include "boost/regex.hpp" +#include "fmt/format.h" + #include #include #include @@ -91,7 +93,7 @@ FileSequence::FileSequence( const std::string &fileSequenceStr ) spaceIndex = fileSequenceCopy.find_first_of( " " ); } - + } setFileName( filename ); setFrameList( frameList ); @@ -206,14 +208,14 @@ FrameList::Frame FileSequence::frameForFileName( const std::string &fileName ) c if ( fileName.substr( 0, prefix.size() ) != prefix || fileName.substr( fileName.size() - suffix.size(), suffix.size() ) != suffix ) { - throw InvalidArgumentException( ( boost::format( "Filename \"%s\" is not a part of sequence \"%s\"." ) % fileName % asString() ).str() ); + throw InvalidArgumentException( fmt::format( "Filename \"{}\" is not a part of sequence \"{}\".", fileName, asString() ) ); } std::string frameStr = fileName.substr( prefix.size(), fileName.size() - suffix.size() - prefix.size() ); if ( frameStr.size() == 0 ) { - throw InvalidArgumentException( ( boost::format( "Filename \"%s\" is not a part of sequence \"%s\"." ) % fileName % asString() ).str() ); + throw InvalidArgumentException( fmt::format( "Filename \"{}\" is not a part of sequence \"{}\".", fileName, asString() ) ); } return boost::lexical_cast< FrameList::Frame >( frameStr ); diff --git a/src/IECore/FileSequenceFunctions.cpp b/src/IECore/FileSequenceFunctions.cpp index bbb7482c1a..239ff02bcd 100644 --- a/src/IECore/FileSequenceFunctions.cpp +++ b/src/IECore/FileSequenceFunctions.cpp @@ -45,7 +45,6 @@ #include "boost/filesystem/directory.hpp" #include "boost/filesystem/operations.hpp" #include "boost/filesystem/path.hpp" -#include "boost/format.hpp" #include "boost/lexical_cast.hpp" #include "boost/regex.hpp" #include "boost/version.hpp" diff --git a/src/IECore/FrameList.cpp b/src/IECore/FrameList.cpp index c73ecdc15d..e749a22106 100644 --- a/src/IECore/FrameList.cpp +++ b/src/IECore/FrameList.cpp @@ -36,7 +36,7 @@ #include "IECore/Exception.h" -#include "boost/format.hpp" +#include "fmt/format.h" #include @@ -108,7 +108,7 @@ FrameListPtr FrameList::parse( const std::string &frameList ) } } - throw Exception( ( boost::format( "\"%s\" does not define a valid frame list." ) % ( frameList ) ).str() ); + throw Exception( fmt::format( "\"{}\" does not define a valid frame list.", frameList ) ); } bool FrameList::isEqualTo( ConstFrameListPtr other ) const diff --git a/src/IECore/FrameRange.cpp b/src/IECore/FrameRange.cpp index 8266abfaa2..e51d3cdcab 100644 --- a/src/IECore/FrameRange.cpp +++ b/src/IECore/FrameRange.cpp @@ -36,10 +36,11 @@ #include "IECore/Exception.h" -#include "boost/format.hpp" #include "boost/lexical_cast.hpp" #include "boost/regex.hpp" +#include "fmt/format.h" + #include using namespace IECore; @@ -126,15 +127,15 @@ std::string FrameRange::asString() const { if ( m_step != 1 ) { - return ( boost::format( "%d-%dx%d") % m_start % m_end % m_step ).str(); + return fmt::format( "{}-{}x{}", m_start, m_end, m_step ); } else if ( m_start != m_end ) { - return ( boost::format( "%d-%d") % m_start % m_end ).str(); + return fmt::format( "{}-{}", m_start, m_end ); } else { - return ( boost::format( "%d") % m_start ).str(); + return fmt::format( "{}", m_start ); } } diff --git a/src/IECore/HeaderGenerator.cpp b/src/IECore/HeaderGenerator.cpp index dd9b990abd..9060a78069 100644 --- a/src/IECore/HeaderGenerator.cpp +++ b/src/IECore/HeaderGenerator.cpp @@ -40,7 +40,6 @@ #include "boost/algorithm/string/trim.hpp" #include "boost/algorithm/string.hpp" -#include "boost/format.hpp" #ifndef _MSC_VER #include @@ -125,7 +124,7 @@ static void unameHeaderGenerator( CompoundObjectPtr header ) } // Getting the Windows OS version (and the build number in particular) from - // GetVersionEx, which is deprecated, is unreliable even when not running in + // GetVersionEx, which is deprecated, is unreliable even when not running in // Compatibility Mode. We match the Python method from // https://github.com/python/cpython/blob/main/Python/sysmodule.c. // This tries to get the version from kernel32.dll (a core Windows library) @@ -144,8 +143,8 @@ static void unameHeaderGenerator( CompoundObjectPtr header ) char kernel32Path[MAX_PATH]; DWORD versionBlockSize; LPVOID versionBlock; - if( - kernel32Handle && + if( + kernel32Handle && GetModuleFileNameA( kernel32Handle, kernel32Path, MAX_PATH ) && ( versionBlockSize = GetFileVersionInfoSizeA( kernel32Path, NULL ) ) && ( versionBlock = malloc( versionBlockSize ) ) @@ -163,7 +162,7 @@ static void unameHeaderGenerator( CompoundObjectPtr header ) std::to_string( HIWORD( fixedFileInfo->dwProductVersionMS ) ) ); compound->writable()["systemVersion"] = new StringData( - std::to_string( HIWORD( fixedFileInfo->dwProductVersionMS ) ) + "." + + std::to_string( HIWORD( fixedFileInfo->dwProductVersionMS ) ) + "." + std::to_string( LOWORD( fixedFileInfo->dwProductVersionMS ) ) + "." + std::to_string( HIWORD( fixedFileInfo->dwProductVersionLS ) ) ); @@ -175,14 +174,14 @@ static void unameHeaderGenerator( CompoundObjectPtr header ) { compound->writable()["systemRelease"] = new StringData( std::to_string( ovx.dwMajorVersion ) ); compound->writable()["systemVersion"] = new StringData( - std::to_string( ovx.dwMajorVersion ) + "." + + std::to_string( ovx.dwMajorVersion ) + "." + std::to_string( ovx.dwMinorVersion ) + "." + std::to_string(ovx.dwBuildNumber ) ); } header->members()["host"] = compound; - + #endif } diff --git a/src/IECore/IECore.cpp b/src/IECore/IECore.cpp index bc75daba5a..0d754ca544 100644 --- a/src/IECore/IECore.cpp +++ b/src/IECore/IECore.cpp @@ -35,8 +35,6 @@ #include "IECore/IECore.h" -#include "boost/format.hpp" - namespace IECore { diff --git a/src/IECore/IFFFile.cpp b/src/IECore/IFFFile.cpp index b969f5c08b..6112935f22 100644 --- a/src/IECore/IFFFile.cpp +++ b/src/IECore/IFFFile.cpp @@ -100,7 +100,7 @@ IFFFile::Chunk *IFFFile::root() { if ( !open() ) { - throw Exception( ( boost::format( "Failed to load \"%s\"." ) % m_streamFileName ).str() ); + throw Exception( fmt::format( "Failed to load \"{}\".", m_streamFileName ) ); } return m_root; diff --git a/src/IECore/LensModel.cpp b/src/IECore/LensModel.cpp index 6daf26bef7..e90e2477aa 100644 --- a/src/IECore/LensModel.cpp +++ b/src/IECore/LensModel.cpp @@ -142,7 +142,9 @@ LensModelPtr LensModel::create( const std::string &name ) { // Check to see whether the requested lens model is registered and if not, throw an exception. if ( creators().find( name ) == creators().end() ) - throw IECore::Exception( (boost::format("LensModel: Could not find registered lens model \"%s\".") % name).str() ); + { + throw IECore::Exception( fmt::format( "LensModel: Could not find registered lens model \"{}\".", name ) ); + } LensModelPtr lensModel = (creators()[name])( new CompoundObject() ); @@ -163,7 +165,9 @@ LensModelPtr LensModel::create( IECore::ConstCompoundObjectPtr lensParams ) // Check to see whether the requested lens model is registered and if not, throw an exception. if ( creators().find( name ) == creators().end() ) - throw IECore::Exception( (boost::format("LensModel: Could not find registered lens model \"%s\".") % name).str() ); + { + throw IECore::Exception( fmt::format( "LensModel: Could not find registered lens model \"{}\".", name ) ); + } LensModelPtr lensModel = (creators()[name])( lensParams ); diff --git a/src/IECore/MurmurHash.cpp b/src/IECore/MurmurHash.cpp index 80dd523309..b251bff429 100644 --- a/src/IECore/MurmurHash.cpp +++ b/src/IECore/MurmurHash.cpp @@ -35,7 +35,7 @@ #include "IECore/MurmurHash.h" #include "IECore/Exception.h" -#include +#include "fmt/format.h" #include #include @@ -57,11 +57,8 @@ void internalFromString( const std::string &repr, uint64_t &h1, uint64_t &h2 ) if( repr.length() != static_cast( 32 ) ) { throw Exception( - boost::str( - boost::format( - "Invalid IECore::MurmurHash string representation \"%s\", must have 32 characters" ) - % repr - ) ); + fmt::format( "Invalid IECore::MurmurHash string representation \"{}\", must have 32 characters", repr ) + ); } std::stringstream s; diff --git a/src/IECore/Object.cpp b/src/IECore/Object.cpp index 73e78d2da2..a2986fc367 100644 --- a/src/IECore/Object.cpp +++ b/src/IECore/Object.cpp @@ -36,11 +36,12 @@ #include "IECore/MurmurHash.h" -#include "boost/format.hpp" +#include "boost/shared_ptr.hpp" #include "boost/tokenizer.hpp" -#include +#include "fmt/format.h" +#include using namespace IECore; using namespace std; @@ -412,7 +413,7 @@ void Object::copyFrom( const Object *toCopy ) { if ( !toCopy->isInstanceOf( typeId() ) ) { - throw InvalidArgumentException( ( boost::format( "\"%s\" is not an instance of \"%s\"" ) % toCopy->typeName() % typeName() ).str() ); + throw InvalidArgumentException( fmt::format( "\"{}\" is not an instance of \"{}\"", toCopy->typeName(), typeName() ) ); } CopyContext context; @@ -533,12 +534,12 @@ ObjectPtr Object::create( TypeId typeId ) TypeInformation::TypeIdsToCreatorsMap::const_iterator it = i->typeIdsToCreators.find( typeId ); if( it==i->typeIdsToCreators.end() ) { - throw Exception( ( boost::format( "Type %d is not a registered Object type." ) % typeId ).str() ); + throw Exception( fmt::format( "Type \"{}\" is not a registered Object type.", typeId ) ); } if( !it->second ) { - throw Exception( ( boost::format( "Type %d is an abstract type." ) % typeId ).str() ); + throw Exception( fmt::format( "Type \"{}\" is an abstract type.", typeId ) ); } return it->second(); @@ -550,12 +551,12 @@ ObjectPtr Object::create( const std::string &typeName ) TypeInformation::TypeNamesToCreatorsMap::const_iterator it = i->typeNamesToCreators.find( typeName ); if( it==i->typeNamesToCreators.end() ) { - throw Exception( ( boost::format( "Type \"%s\" is not a registered Object type." ) % typeName ).str() ); + throw Exception( fmt::format( "Type \"{}\" is not a registered Object type.", typeName ) ); } if( !it->second ) { - throw Exception( ( boost::format( "Type \"%s\" is an abstract type." ) % typeName ).str() ); + throw Exception( fmt::format( "Type \"{}\" is an abstract type.", typeName ) ); } return it->second(); diff --git a/src/IECore/ObjectVector.cpp b/src/IECore/ObjectVector.cpp index f40ae13b60..696817d453 100644 --- a/src/IECore/ObjectVector.cpp +++ b/src/IECore/ObjectVector.cpp @@ -36,9 +36,10 @@ #include "IECore/MurmurHash.h" -#include "boost/format.hpp" #include "boost/lexical_cast.hpp" +#include "fmt/format.h" + using namespace IECore; static IndexedIO::EntryID g_sizeEntry("size"); @@ -98,7 +99,7 @@ void ObjectVector::save( SaveContext *context ) const { if( *it ) { - std::string name = str( boost::format( "%d" ) % i ); + std::string name = fmt::format( "{}", i ); context->save( it->get(), ioMembers.get(), name ); } i++; diff --git a/src/IECore/RunTimeTyped.cpp b/src/IECore/RunTimeTyped.cpp index 8c864653f9..2d17497737 100644 --- a/src/IECore/RunTimeTyped.cpp +++ b/src/IECore/RunTimeTyped.cpp @@ -36,8 +36,6 @@ #include "IECore/MessageHandler.h" -#include "boost/format.hpp" - #include #include @@ -120,7 +118,7 @@ void RunTimeTyped::registerType( TypeId derivedTypeId, const char *derivedTypeNa { if ( baseTypeId != lb->second ) { - msg( Msg::Warning, "RunTimeTyped", boost::format( "Duplicate registration of base type id for '%s' - %d and %d") % derivedTypeName % lb->second % baseTypeId ); + msg( Msg::Warning, "RunTimeTyped", "Duplicate registration of base type id for '{}' - {} and {}", derivedTypeName, lb->second, baseTypeId ); } } else @@ -142,7 +140,7 @@ void RunTimeTyped::registerType( TypeId derivedTypeId, const char *derivedTypeNa { if ( std::string( derivedTypeName ) != lb->second ) { - msg( Msg::Warning, "RunTimeTyped", boost::format( "Duplicate registration of type name for type id %d - '%s' and '%s'" ) % derivedTypeId % lb->second % derivedTypeName ); + msg( Msg::Warning, "RunTimeTyped", "Duplicate registration of type name for type id {} - '{}' and '{}'", derivedTypeId, lb->second, derivedTypeName ); } } else @@ -161,7 +159,7 @@ void RunTimeTyped::registerType( TypeId derivedTypeId, const char *derivedTypeNa { if ( derivedTypeId != lb->second ) { - msg( Msg::Warning, "RunTimeTyped", boost::format( "Duplicate registration of type id for type name '%s' - %d and %d") % derivedTypeName % lb->second % derivedTypeId ); + msg( Msg::Warning, "RunTimeTyped", "Duplicate registration of type id for type name '{}' - {} and {}", derivedTypeName, lb->second, derivedTypeId ); } } else diff --git a/src/IECore/StreamIndexedIO.cpp b/src/IECore/StreamIndexedIO.cpp index 27f611e1b9..53494d54cf 100644 --- a/src/IECore/StreamIndexedIO.cpp +++ b/src/IECore/StreamIndexedIO.cpp @@ -47,7 +47,6 @@ #include "tbb/spin_rw_mutex.h" -#include "boost/format.hpp" #include "boost/iostreams/device/file.hpp" #include "boost/iostreams/filter/gzip.hpp" #include "boost/iostreams/filtering_stream.hpp" @@ -55,6 +54,8 @@ #include "boost/iostreams/stream.hpp" #include "boost/tokenizer.hpp" +#include "fmt/format.h" + #include #include #include @@ -273,7 +274,7 @@ class StreamIndexedIO::StringCache StringToIdMap::const_iterator it = m_stringToIdMap.find( s ); if ( it == m_stringToIdMap.end() ) { - throw IOException( (boost::format ( "StringCache: could not find string %s!" ) % s.value() ).str() ); + throw IOException( fmt::format( "StringCache: could not find string {}!", s.value() ) ); } return it->second; } @@ -286,7 +287,7 @@ class StreamIndexedIO::StringCache { if (errIfNotFound) { - throw IOException( (boost::format ( "StringCache: could not find string %s!" ) % s.value() ).str() ); + throw IOException( fmt::format( "StringCache: could not find string {}!", s.value() ) ); } uint64_t id = ++m_prevId; @@ -310,7 +311,7 @@ class StreamIndexedIO::StringCache { if ( id >= m_idToStringMap.size() ) { - throw IOException( (boost::format ( "StringCache: invalid string ID %d!" ) % id ).str() ); + throw IOException( fmt::format( "StringCache: invalid string ID {}!", id ) ); } return m_idToStringMap[id]; } @@ -1467,9 +1468,9 @@ void StreamIndexedIO::Node::addDataChild( if( numCompressedBlocks > std::numeric_limits::max() ) { throw IECore::Exception( - boost::str( - boost::format( "StreamIndexedIO::Node::addDataChild - Unable to store file with more than %1% compressed blocks " ) % - std::numeric_limits::max() + fmt::format( + "StreamIndexedIO::Node::addDataChild - Unable to store file with more than {} compressed blocks ", + std::numeric_limits::max() ) ); } @@ -1957,7 +1958,7 @@ NodeBase *StreamIndexedIO::Index::readNodeV5( F &f ) } else { - throw IOException( boost::str( boost::format( "StreamIndexedIO::Index::readNodeV5 Invalid EntryType found '%1%'" ) % entryType ) ); + throw IOException( fmt::format( "StreamIndexedIO::Index::readNodeV5 Invalid EntryType found '{}'", entryType ) ); } } @@ -2028,7 +2029,7 @@ NodeBase *StreamIndexedIO::Index::readNode( F &f ) } else { - throw IOException( boost::str( boost::format( "StreamIndexedIO::Index::readNode - Invalid EntryType found '%1%'" ) % nodeType ) ); + throw IOException( fmt::format( "StreamIndexedIO::Index::readNode - Invalid EntryType found '{}'", nodeType ) ); } } @@ -3245,10 +3246,9 @@ void StreamIndexedIO::read(const IndexedIO::EntryID &name, InternedString *&x, s if ( arraySizeInBytes != nodeInfo.decompressedSize ) { throw IECore::IOException( - boost::str( - boost::format( "StreamIndexedIO::rawRead - array size (%1%) does not match block size (%2%) " ) % - arraySizeInBytes % - nodeInfo.decompressedSize + fmt::format( + "StreamIndexedIO::rawRead - array size ({}) does not match block size ({}) ", + arraySizeInBytes, nodeInfo.decompressedSize ) ); } @@ -3366,10 +3366,9 @@ void StreamIndexedIO::rawRead(const IndexedIO::EntryID &name, T *&x, size_t arra if ( arraySizeInBytes != nodeInfo.decompressedSize ) { throw IECore::IOException( - boost::str( - boost::format( "StreamIndexedIO::rawRead - array size (%1%) does not match block size (%2%) " ) % - arraySizeInBytes % - nodeInfo.decompressedSize + fmt::format( + "StreamIndexedIO::rawRead - array size ({}) does not match block size ({})", + arraySizeInBytes, nodeInfo.decompressedSize ) ); } diff --git a/src/IECore/Timer.cpp b/src/IECore/Timer.cpp index d6688870c8..d0dde8b02d 100644 --- a/src/IECore/Timer.cpp +++ b/src/IECore/Timer.cpp @@ -121,6 +121,6 @@ ScopedTimer::~ScopedTimer() IECore::msg( IECore::MessageHandler::Debug, "ScopedTimer", - boost::str( boost::format( "[timed block] name: '%1%' time: %2% ms" ) % m_name % (m_timer.currentElapsed() * 1000.0) ) + "[timed block] name: '{}' time: {} ms", m_name, (m_timer.currentElapsed() * 1000.0) ); } \ No newline at end of file diff --git a/src/IECore/Version.cpp b/src/IECore/Version.cpp index 5e6e0aa6a9..a64619cc23 100644 --- a/src/IECore/Version.cpp +++ b/src/IECore/Version.cpp @@ -34,7 +34,7 @@ #include "IECore/Version.h" -#include "boost/format.hpp" +#include "fmt/format.h" int IECore::milestoneVersion() { @@ -63,12 +63,12 @@ int IECore::compatibilityVersion() const std::string &IECore::compatibilityVersionString() { - static std::string v = boost::str( boost::format( "%d.%d" ) % milestoneVersion() % majorVersion() ); + static std::string v = fmt::format( "{}.{}", milestoneVersion(), majorVersion() ); return v; } const std::string &IECore::versionString() { - static std::string v = boost::str( boost::format( "%d.%d.%d.%d" ) % milestoneVersion() % majorVersion() % minorVersion() % patchVersion() ); + static std::string v = fmt::format( "{}.{}.{}.{}", milestoneVersion(), majorVersion(), minorVersion(), patchVersion() ); return v; } From ff88a6eba95131696ef6ea51bc0d429c93c9e92f Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:57:05 -0800 Subject: [PATCH 06/10] IECoreImage : Prefer fmt::format --- include/IECoreImage/ImagePrimitive.inl | 1 - src/IECoreImage/ChannelOp.cpp | 6 +++--- src/IECoreImage/DisplayDriver.cpp | 4 +++- src/IECoreImage/HdrMergeOp.cpp | 2 -- src/IECoreImage/ImageCropOp.cpp | 2 -- src/IECoreImage/ImageDiffOp.cpp | 4 +--- src/IECoreImage/ImageReader.cpp | 4 +++- src/IECoreImage/ImageWriter.cpp | 8 +++++--- src/IECoreImage/LuminanceOp.cpp | 8 ++++---- src/IECoreImage/MPlayDisplayDriver.cpp | 6 +++--- src/IECoreImage/MedianCutSampler.cpp | 5 +++-- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/IECoreImage/ImagePrimitive.inl b/include/IECoreImage/ImagePrimitive.inl index 46527262d5..8252960769 100644 --- a/include/IECoreImage/ImagePrimitive.inl +++ b/include/IECoreImage/ImagePrimitive.inl @@ -43,7 +43,6 @@ IECORE_PUSH_DEFAULT_VISIBILITY #include "Imath/half.h" IECORE_POP_DEFAULT_VISIBILITY -#include "boost/format.hpp" #include "boost/static_assert.hpp" namespace IECoreImage diff --git a/src/IECoreImage/ChannelOp.cpp b/src/IECoreImage/ChannelOp.cpp index 210ecc8fcc..2abdfca18b 100644 --- a/src/IECoreImage/ChannelOp.cpp +++ b/src/IECoreImage/ChannelOp.cpp @@ -41,7 +41,7 @@ #include "IECore/DespatchTypedData.h" #include "IECore/TypeTraits.h" -#include "boost/format.hpp" +#include "fmt/format.h" using namespace IECore; using namespace IECoreImage; @@ -99,12 +99,12 @@ void ChannelOp::modify( Object * primitive, const CompoundObject * operands ) std::string reason; if( !image->channelValid( name, &reason ) ) { - throw Exception( str( format( "Channel \"%s\" is invalid: " ) % name ) + reason ); + throw Exception( fmt::format( "Channel \"{}\" is invalid: {}", name, reason ) ); } if( !image->channels[name]->isInstanceOf( FloatVectorData::staticTypeId() ) ) { - throw Exception( str( format( "Channel \"%s\" is invalid: not a float vector." ) % name ) ); + throw Exception( fmt::format( "Channel \"{}\" is invalid: not a float vector.", name ) ); } channels.push_back( boost::static_pointer_cast< FloatVectorData >( image->channels[name] ) ); diff --git a/src/IECoreImage/DisplayDriver.cpp b/src/IECoreImage/DisplayDriver.cpp index 2619898032..e3cc3b9716 100644 --- a/src/IECoreImage/DisplayDriver.cpp +++ b/src/IECoreImage/DisplayDriver.cpp @@ -34,6 +34,8 @@ #include "IECoreImage/DisplayDriver.h" +#include "fmt/format.h" + using namespace std; using namespace Imath; using namespace IECore; @@ -75,7 +77,7 @@ DisplayDriverPtr DisplayDriver::create( const std::string &typeName, const Imath return it->second( displayWindow, dataWindow, channelNames, parameters ); } - throw Exception( boost::str( boost::format( "Display driver \"%s\" not registered" ) % typeName ) ); + throw Exception( fmt::format( "Display driver \"{}\" not registered", typeName ) ); } void DisplayDriver::registerType( const std::string &typeName, CreatorFn creator ) diff --git a/src/IECoreImage/HdrMergeOp.cpp b/src/IECoreImage/HdrMergeOp.cpp index 7e50ccc85c..280077878c 100644 --- a/src/IECoreImage/HdrMergeOp.cpp +++ b/src/IECoreImage/HdrMergeOp.cpp @@ -41,8 +41,6 @@ #include "IECore/ObjectVector.h" #include "IECore/TypedObjectParameter.h" -#include "boost/format.hpp" - #include using namespace std; diff --git a/src/IECoreImage/ImageCropOp.cpp b/src/IECoreImage/ImageCropOp.cpp index 89a4159733..554138d089 100644 --- a/src/IECoreImage/ImageCropOp.cpp +++ b/src/IECoreImage/ImageCropOp.cpp @@ -46,8 +46,6 @@ #include "IECore/TypedObjectParameter.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - #include using namespace std; diff --git a/src/IECoreImage/ImageDiffOp.cpp b/src/IECoreImage/ImageDiffOp.cpp index 1c6646eec1..610c323ba8 100644 --- a/src/IECoreImage/ImageDiffOp.cpp +++ b/src/IECoreImage/ImageDiffOp.cpp @@ -50,8 +50,6 @@ #include "IECore/ScaledDataConversion.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - #include #include @@ -318,7 +316,7 @@ ObjectPtr ImageDiffOp::doOperation( const CompoundObject * operands ) catch ( Exception & ) { - msg( Msg::Warning, "ImageDiffOp", boost::format( "Could not convert data for image channel '%s' to floating point" ) % name ); + msg( Msg::Warning, "ImageDiffOp", "Could not convert data for image channel '{}' to floating point", name ); return new BoolData( true ); } diff --git a/src/IECoreImage/ImageReader.cpp b/src/IECoreImage/ImageReader.cpp index d4cf5f1ef1..49dad2f9f3 100644 --- a/src/IECoreImage/ImageReader.cpp +++ b/src/IECoreImage/ImageReader.cpp @@ -53,6 +53,8 @@ #include "boost/tokenizer.hpp" +#include "fmt/format.h" + OIIO_NAMESPACE_USING using namespace std; @@ -377,7 +379,7 @@ class ImageReader::Implementation } default : { - throw IECore::IOException( ( boost::format( "ImageReader : Unsupported data type \"%d\"" ) % spec->format ).str() ); + throw IECore::IOException( fmt::format( "ImageReader : Unsupported data type \"{}\"", spec->format ) ); } } } diff --git a/src/IECoreImage/ImageWriter.cpp b/src/IECoreImage/ImageWriter.cpp index 3ebf5d96b3..92e7c265e2 100644 --- a/src/IECoreImage/ImageWriter.cpp +++ b/src/IECoreImage/ImageWriter.cpp @@ -67,6 +67,8 @@ #include #endif +#include "fmt/format.h" + OIIO_NAMESPACE_USING using namespace std; @@ -603,7 +605,7 @@ void ImageWriter::doWrite( const CompoundObject *operands ) } else { - throw IECore::Exception( boost::str( boost::format( "IECoreImage::ImageWriter : Could not open \"%s\", error = %s" ) % fileName() % out->geterror() ) ); + throw IECore::Exception( fmt::format( "IECoreImage::ImageWriter : Could not open \"{}\", error = {}", fileName(), out->geterror() ) ); } ImagePrimitivePtr correctedImage = nullptr; @@ -633,7 +635,7 @@ void ImageWriter::doWrite( const CompoundObject *operands ) const OpenImageIOAlgo::DataView dataView( buffer.get() ); if( dataView.type == TypeDesc::UNKNOWN ) { - throw IECore::Exception( boost::str( boost::format( "IECoreImage::ImageWriter : Failed to write \"%s\". Unsupported dataType %s." ) % fileName() % buffer->typeName() ) ); + throw IECore::Exception( fmt::format( "IECoreImage::ImageWriter : Failed to write \"{}\". Unsupported dataType {}.", fileName(), buffer->typeName() ) ); } const unsigned char *rawBuffer = (const unsigned char *)dataView.data; @@ -694,7 +696,7 @@ void ImageWriter::doWrite( const CompoundObject *operands ) if( !status ) { - throw IECore::Exception( boost::str( boost::format( "IECoreImage::ImageWriter : Failed to write \"%s\", error = %s" ) % fileName() % out->geterror() ) ); + throw IECore::Exception( fmt::format( "IECoreImage::ImageWriter : Failed to write \"{}\", error = {}", fileName(), out->geterror() ) ); } } diff --git a/src/IECoreImage/LuminanceOp.cpp b/src/IECoreImage/LuminanceOp.cpp index 6290e45b92..259f461011 100644 --- a/src/IECoreImage/LuminanceOp.cpp +++ b/src/IECoreImage/LuminanceOp.cpp @@ -42,7 +42,7 @@ #include "IECore/DespatchTypedData.h" #include "IECore/MessageHandler.h" -#include "boost/format.hpp" +#include "fmt/format.h" using namespace boost; using namespace Imath; @@ -250,15 +250,15 @@ void LuminanceOp::modify( Object *object, const CompoundObject *operands ) std::string reason; if( !image->channelValid( rIt->first, &reason ) ) { - throw Exception( str( format( "Channel \"%s\" is invalid: " ) % rIt->first ) + reason ); + throw Exception( fmt::format( "Channel \"{}\" is invalid: {}", rIt->first, reason ) ); } if( !image->channelValid( gIt->first, &reason ) ) { - throw Exception( str( format( "Channel \"%s\" is invalid: " ) % gIt->first ) + reason ); + throw Exception( fmt::format( "Channel \"{}\" is invalid: {}", gIt->first, reason ) ); } if( !image->channelValid( bIt->first, &reason ) ) { - throw Exception( str( format( "Channel \"%s\" is invalid: " ) % bIt->first ) + reason ); + throw Exception( fmt::format( "Channel \"{}\" is invalid: {}", bIt->first, reason ) ); } size_t channelSize = image->channelSize(); diff --git a/src/IECoreImage/MPlayDisplayDriver.cpp b/src/IECoreImage/MPlayDisplayDriver.cpp index ec01d5ca95..8c70723feb 100644 --- a/src/IECoreImage/MPlayDisplayDriver.cpp +++ b/src/IECoreImage/MPlayDisplayDriver.cpp @@ -38,7 +38,7 @@ #include "IECore/Exception.h" #include "IECore/SimpleTypedData.h" -#include "boost/format.hpp" +#include "fmt/format.h" #ifdef _MSC_VER #include @@ -186,10 +186,10 @@ MPlayDisplayDriver::MPlayDisplayDriver( const Imath::Box2i &displayWindow, const // Construct a command line calling imdisplay, and open it as a pipe std::string commandLine = "imdisplay -f -p"; - commandLine += boost::str( boost::format( " -o %d %d" ) % displayWindow.min.x % displayWindow.min.y ); + commandLine += fmt::format( " -o {} {}", displayWindow.min.x, displayWindow.min.y ); V2i originalSize = displayWindow.size() + V2i( 1 ); - commandLine += boost::str( boost::format( " -Z %d %d" ) % originalSize.x % originalSize.y ); + commandLine += fmt::format( " -Z {} {}", originalSize.x, originalSize.y ); const StringData *extraArguments = parameters->member( "imdisplayExtraArguments" ); if( extraArguments && extraArguments->readable().size() ) diff --git a/src/IECoreImage/MedianCutSampler.cpp b/src/IECoreImage/MedianCutSampler.cpp index b49783353e..35c0a6e908 100644 --- a/src/IECoreImage/MedianCutSampler.cpp +++ b/src/IECoreImage/MedianCutSampler.cpp @@ -42,9 +42,10 @@ #include "IECore/Math.h" #include "IECore/NullObject.h" -#include "boost/format.hpp" #include "boost/multi_array.hpp" +#include "fmt/format.h" + using namespace std; using namespace boost; using namespace Imath; @@ -226,7 +227,7 @@ ObjectPtr MedianCutSampler::doOperation( const CompoundObject * operands ) FloatVectorDataPtr luminance = image->getChannel( channelName ); if( !luminance ) { - throw Exception( str( format( "No FloatVectorData channel named \"%s\"." ) % channelName ) ); + throw Exception( fmt::format( "No FloatVectorData channel named \"{}\".", channelName ) ); } // if the projection requires it, weight the luminances so they're less From e37ffa9f7a2e7d36fdefc4569009b1d9d82b1096 Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:57:12 -0800 Subject: [PATCH 07/10] IECoreScene : Prefer fmt::format --- include/IECoreScene/ParticleReader.inl | 2 +- include/IECoreScene/Primitive.inl | 49 +++++------ .../IECoreScene/private/PrimitiveAlgoUtils.h | 15 ++-- .../private/PrimitiveVariableAlgos.h | 10 ++- src/IECoreScene/CurveLineariser.cpp | 4 +- src/IECoreScene/CurveTangentsOp.cpp | 5 +- src/IECoreScene/CurvesAlgo.cpp | 3 +- src/IECoreScene/CurvesAlgoSegment.cpp | 2 - src/IECoreScene/FaceVaryingPromotionOp.cpp | 3 +- src/IECoreScene/LinkedScene.cpp | 4 +- src/IECoreScene/MeshAlgoDeleteFaces.cpp | 3 +- src/IECoreScene/MeshAlgoDistortions.cpp | 9 +- src/IECoreScene/MeshAlgoDistributePoints.cpp | 17 ++-- src/IECoreScene/MeshAlgoFaceArea.cpp | 5 +- src/IECoreScene/MeshAlgoMerge.cpp | 2 - src/IECoreScene/MeshAlgoNormals.cpp | 7 +- src/IECoreScene/MeshAlgoReorder.cpp | 11 ++- src/IECoreScene/MeshAlgoSegment.cpp | 2 - src/IECoreScene/MeshAlgoTangents.cpp | 63 ++++++++------ src/IECoreScene/MeshAlgoTriangulate.cpp | 8 +- src/IECoreScene/MeshNormalsOp.cpp | 2 - src/IECoreScene/MeshPrimitive.cpp | 40 ++++----- src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp | 6 +- src/IECoreScene/MeshVertexReorderOp.cpp | 2 - src/IECoreScene/NParticleReader.cpp | 12 +-- src/IECoreScene/PDCParticleWriter.cpp | 4 +- src/IECoreScene/PointsAlgo.cpp | 16 ++-- src/IECoreScene/PrimitiveInterpolator.cpp | 14 ++-- src/IECoreScene/SceneCache.cpp | 51 ++++++----- src/IECoreScene/ShaderNetwork.cpp | 84 ++++++++----------- src/IECoreScene/ShaderNetworkAlgo.cpp | 18 ++-- src/IECoreScene/bindings/PrimitiveBinding.cpp | 14 ++-- .../bindings/PrimitiveVariableBinding.cpp | 8 +- 33 files changed, 218 insertions(+), 277 deletions(-) diff --git a/include/IECoreScene/ParticleReader.inl b/include/IECoreScene/ParticleReader.inl index 8524a64daf..1e01bbf4c7 100644 --- a/include/IECoreScene/ParticleReader.inl +++ b/include/IECoreScene/ParticleReader.inl @@ -60,7 +60,7 @@ typename T::Ptr ParticleReader::filterAttr( const F *attr, float percentage, con } else { - msg( IECore::Msg::Warning, "ParticleReader::filterAttr", boost::format( "Unrecognized id data type in file \"%s\"! Disabling filtering." ) % fileName() ); + msg( IECore::Msg::Warning, "ParticleReader::filterAttr", "Unrecognized id data type in file \"{}\"! Disabling filtering.", fileName() ); } } else diff --git a/include/IECoreScene/Primitive.inl b/include/IECoreScene/Primitive.inl index 5ba7948fce..e4895c2248 100644 --- a/include/IECoreScene/Primitive.inl +++ b/include/IECoreScene/Primitive.inl @@ -46,7 +46,7 @@ Primitive::variableIndexedView( const std::string &name, PrimitiveVariable::Inte { if( throwIfInvalid ) { - throw IECore::InvalidArgumentException( boost::str( boost::format( "Primitive::variableIndexedView - No primvar named '%1%' found" ) % name ) ); + throw IECore::InvalidArgumentException( fmt::format( "Primitive::variableIndexedView - No primvar named '{}' found", name ) ); } else { @@ -59,10 +59,9 @@ Primitive::variableIndexedView( const std::string &name, PrimitiveVariable::Inte if( throwIfInvalid ) { throw IECore::InvalidArgumentException( - boost::str( - boost::format( - "Primitive::variableIndexedView - PrimVar '%1%' interpolation (%2%) doesn't match requiredInterpolation (%3%)" - ) % name % it->second.interpolation % requiredInterpolation + fmt::format( + "Primitive::variableIndexedView - PrimVar '{}' interpolation ({}) doesn't match requiredInterpolation ({})", + name, it->second.interpolation, requiredInterpolation ) ); } @@ -83,11 +82,9 @@ Primitive::variableIndexedView( const std::string &name, PrimitiveVariable::Inte else if( throwIfInvalid ) { throw IECore::InvalidArgumentException( - boost::str( - boost::format( "Primitive::variableIndexedView - Unable to created indexed view for '%1%' PrimVar, requested type: '%2%', actual type: '%3%'" ) % - name % - T::baseTypeName() % - it->second.data->typeName() + fmt::format( + "Primitive::variableIndexedView - Unable to created indexed view for '{}' PrimVar, requested type: '{}', actual type: '{}'", + name, T::baseTypeName(), it->second.data->typeName() ) ); } @@ -112,10 +109,9 @@ T *Primitive::variableData( const std::string &name, PrimitiveVariable::Interpol if( it->second.indices ) { throw IECore::Exception( - boost::str( - boost::format( - "Primitive::variableData() can only be used for non-indexed variables. Use Primitive::expandedVariableData() or access Primitive::variables directly. Primitive variable name: '%1%'" - ) % name + fmt::format( + "Primitive::variableData() can only be used for non-indexed variables. Use Primitive::expandedVariableData() or access Primitive::variables directly. Primitive variable name: '{}'", + name ) ); } @@ -138,10 +134,9 @@ const T *Primitive::variableData( const std::string &name, PrimitiveVariable::In if( it->second.indices ) { throw IECore::Exception( - boost::str( - boost::format( - "Primitive::variableData() can only be used for non-indexed variables. Use Primitive::expandedVariableData() or access Primitive::variables directly. Primitive variable name: '%1%'" - ) % name + fmt::format( + "Primitive::variableData() can only be used for non-indexed variables. Use Primitive::expandedVariableData() or access Primitive::variables directly. Primitive variable name: '{}'", + name ) ); } @@ -157,7 +152,7 @@ typename T::Ptr Primitive::expandedVariableData( const std::string &name, Primit { if ( throwIfInvalid ) { - throw IECore::Exception( boost::str( boost::format( "Primitive::expandedVariableData() - Primitive Variable '%1%' not found." ) % name ) ); + throw IECore::Exception( fmt::format( "Primitive::expandedVariableData() - Primitive Variable '{}' not found.", name ) ); } return nullptr; @@ -167,11 +162,9 @@ typename T::Ptr Primitive::expandedVariableData( const std::string &name, Primit if( throwIfInvalid ) { throw IECore::Exception( - boost::str( - boost::format( "Primitive::expandedVariableData() - Primitive Variable '%1%' has interpolation: %2%, required :%3%." ) % - name % - it->second.interpolation % - requiredInterpolation + fmt::format( + "Primitive::expandedVariableData() - Primitive Variable '{}' has interpolation: {}, required: {}.", + name, it->second.interpolation, requiredInterpolation ) ); } @@ -184,11 +177,9 @@ typename T::Ptr Primitive::expandedVariableData( const std::string &name, Primit if( throwIfInvalid ) { throw IECore::Exception( - boost::str( - boost::format( "Primitive::expandedVariableData() - Primitive Variable '%1%' has invalid data type: %2%, required :%3%." ) % - name % - it->second.data->typeName() % - T::staticTypeName() + fmt::format( + "Primitive::expandedVariableData() - Primitive Variable '{}' has invalid data type: {}, required: {}.", + name, it->second.data->typeName(), T::staticTypeName() ) ); } diff --git a/include/IECoreScene/private/PrimitiveAlgoUtils.h b/include/IECoreScene/private/PrimitiveAlgoUtils.h index bf778803ab..bd7505930a 100644 --- a/include/IECoreScene/private/PrimitiveAlgoUtils.h +++ b/include/IECoreScene/private/PrimitiveAlgoUtils.h @@ -46,15 +46,14 @@ #include -#include "boost/format.hpp" - #include "tbb/blocked_range.h" #include "tbb/parallel_for.h" +#include "fmt/format.h" + #include #include - namespace IECoreScene { namespace Detail @@ -129,7 +128,7 @@ struct AverageValueFromVector IECore::DataPtr operator()( IECore::Data *data ) { - throw IECore::InvalidArgumentException( boost::str( boost::format( "PrimitiveAlgoUtils::AverageValueFromVector : Variable has unsupported data type \"%s\"." ) % data->typeName() ) ); + throw IECore::InvalidArgumentException( fmt::format( "PrimitiveAlgoUtils::AverageValueFromVector : Variable has unsupported data type \"{}\".", data->typeName() ) ); } }; @@ -293,11 +292,7 @@ class TaskSegmenter if ( !segments ) { throw IECore::InvalidArgumentException( - ( - boost::format( "Segment keys type '%s' doesn't match primitive variable type '%s'" ) % - m_data->typeName() % - array->typeName() - ).str() + fmt::format( "Segment keys type '{}' doesn't match primitive variable type '{}'", m_data->typeName(), array->typeName() ) ); } @@ -325,7 +320,7 @@ class TaskSegmenter ReturnType operator()( const IECore::Data *data ) { throw IECore::Exception( - boost::str( boost::format( "Unexpected Data: %1%" ) % ( data ? data->typeName() : std::string( "nullptr" ) ) ) + fmt::format( "Unexpected Data: {}", ( data ? data->typeName() : std::string( "nullptr" ) ) ) ); } diff --git a/include/IECoreScene/private/PrimitiveVariableAlgos.h b/include/IECoreScene/private/PrimitiveVariableAlgos.h index b4cd5820f8..fa7162ae64 100644 --- a/include/IECoreScene/private/PrimitiveVariableAlgos.h +++ b/include/IECoreScene/private/PrimitiveVariableAlgos.h @@ -40,6 +40,8 @@ #include "IECore/VectorTypedData.h" +#include "fmt/format.h" + #include namespace IECoreScene @@ -214,7 +216,7 @@ class DeleteFlaggedUniformFunctor : public DeleteFlagged IndexedData operator()( const IECore::Data *data ) { throw IECore::Exception( - boost::str( boost::format( "Unexpected Data: %1%" ) % ( data ? data->typeName() : std::string( "nullptr" ) ) ) + fmt::format( "Unexpected Data: {}", ( data ? data->typeName() : std::string( "nullptr" ) ) ) ); } @@ -259,7 +261,7 @@ class DeleteFlaggedFaceVaryingFunctor : public DeleteFlagged IndexedData operator()( const IECore::Data *data ) { throw IECore::Exception( - boost::str( boost::format( "Unexpected Data: %1%" ) % ( data ? data->typeName() : std::string( "nullptr" ) ) ) + fmt::format( "Unexpected Data: {}", ( data ? data->typeName() : std::string( "nullptr" ) ) ) ); } @@ -307,7 +309,7 @@ class DeleteFlaggedVaryingFunctor : public DeleteFlagged IndexedData operator()( const IECore::Data *data ) { throw IECore::Exception( - boost::str( boost::format( "Unexpected Data: %1%" ) % ( data ? data->typeName() : std::string( "nullptr" ) ) ) + fmt::format( "Unexpected Data: {}", ( data ? data->typeName() : std::string( "nullptr" ) ) ) ); } @@ -399,7 +401,7 @@ class DeleteFlaggedVertexFunctor : public DeleteFlagged IndexedData operator()( const IECore::Data *data ) { throw IECore::Exception( - boost::str( boost::format( "Unexpected Data: %1%" ) % ( data ? data->typeName() : std::string( "nullptr" ) ) ) + fmt::format( "Unexpected Data: {}", ( data ? data->typeName() : std::string( "nullptr" ) ) ) ); } diff --git a/src/IECoreScene/CurveLineariser.cpp b/src/IECoreScene/CurveLineariser.cpp index 3a814bdc47..2318e930a6 100644 --- a/src/IECoreScene/CurveLineariser.cpp +++ b/src/IECoreScene/CurveLineariser.cpp @@ -40,8 +40,6 @@ #include "IECore/FastFloat.h" #include "IECore/MessageHandler.h" -#include "boost/format.hpp" - using namespace IECore; using namespace IECoreScene; using namespace Imath; @@ -145,7 +143,7 @@ void CurveLineariser::modifyTypedPrimitive( CurvesPrimitive * curves, const Comp msg( Msg::Warning, "CurveLineariser::modifyTypedPrimitive", - boost::format( "Ignoring primitive variable \"%s\" with unsupported type \"%s\"" ) % it->first % it->second.data->typeName() + "Ignoring primitive variable \"{}\" with unsupported type \"{}\"", it->first, it->second.data->typeName() ); } } diff --git a/src/IECoreScene/CurveTangentsOp.cpp b/src/IECoreScene/CurveTangentsOp.cpp index 6d6d9d0a21..6ca746d366 100644 --- a/src/IECoreScene/CurveTangentsOp.cpp +++ b/src/IECoreScene/CurveTangentsOp.cpp @@ -41,8 +41,6 @@ #include "IECore/DataCastOp.h" #include "IECore/DespatchTypedData.h" -#include "boost/format.hpp" - #include #include @@ -134,8 +132,7 @@ struct CurveTangentsOp::HandleErrors template void operator()( const T *d, const F &f ) { - string e = boost::str( boost::format( "CurveTangentsOp : P primitive variable has unsupported data type \"%s\"." ) % d->typeName() ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( fmt::format( "CurveTangentsOp : P primitive variable has unsupported data type \"{}\".", d->typeName() ) ); } }; diff --git a/src/IECoreScene/CurvesAlgo.cpp b/src/IECoreScene/CurvesAlgo.cpp index e0cb51b43c..27bb09beab 100644 --- a/src/IECoreScene/CurvesAlgo.cpp +++ b/src/IECoreScene/CurvesAlgo.cpp @@ -410,7 +410,8 @@ CurvesPrimitivePtr deleteCurves( if( !curvesPrimitive->isPrimitiveVariableValid( it->second ) ) { throw InvalidArgumentException( - boost::str ( boost::format( "CurvesAlgo::deleteCurves cannot process invalid primitive variable \"%s\"" ) % it->first ) ); + fmt::format( "CurvesAlgo::deleteCurves cannot process invalid primitive variable \"{}\"", it->first ) + ); } switch( it->second.interpolation ) diff --git a/src/IECoreScene/CurvesAlgoSegment.cpp b/src/IECoreScene/CurvesAlgoSegment.cpp index a31b1cb3dd..e0237b44fe 100644 --- a/src/IECoreScene/CurvesAlgoSegment.cpp +++ b/src/IECoreScene/CurvesAlgoSegment.cpp @@ -40,8 +40,6 @@ #include "IECore/DespatchTypedData.h" #include "IECore/TypeTraits.h" -#include "boost/format.hpp" - using namespace IECore; using namespace IECoreScene; using namespace Imath; diff --git a/src/IECoreScene/FaceVaryingPromotionOp.cpp b/src/IECoreScene/FaceVaryingPromotionOp.cpp index 04b1bd08cb..904a59f57f 100644 --- a/src/IECoreScene/FaceVaryingPromotionOp.cpp +++ b/src/IECoreScene/FaceVaryingPromotionOp.cpp @@ -40,7 +40,6 @@ #include "IECore/CompoundParameter.h" #include "IECore/DespatchTypedData.h" -#include "boost/format.hpp" #include "boost/regex.hpp" using namespace IECore; @@ -255,7 +254,7 @@ void FaceVaryingPromotionOp::modifyTypedPrimitive( MeshPrimitive *mesh, const Co if( !mesh->isPrimitiveVariableValid( it->second ) ) { - throw Exception( boost::str( boost::format( "Primitive variable \"%s\" is not valid." ) % it->first ) ); + throw Exception( fmt::format( "Primitive variable \"{}\" is not valid.", it->first ) ); } promoter.setInterpolation( it->second.interpolation ); diff --git a/src/IECoreScene/LinkedScene.cpp b/src/IECoreScene/LinkedScene.cpp index bfd17eac4e..d4e7a9ef46 100644 --- a/src/IECoreScene/LinkedScene.cpp +++ b/src/IECoreScene/LinkedScene.cpp @@ -763,7 +763,7 @@ void LinkedScene::writeAttribute( const Name &name, const Object *attribute, dou { std::string pathStr; SceneInterface::pathToString( sceneRoot->readable(), pathStr ); - msg( Msg::Debug, "LinkedScene::writeAttribute", ( boost::format( "Detected ancestor tags while creating link to file %s at location %s." ) % fileName->readable() % pathStr ).str() ); + msg( Msg::Debug, "LinkedScene::writeAttribute", "Detected ancestor tags while creating link to file {} at location {}.", fileName->readable(), pathStr ); } tags.clear(); @@ -938,7 +938,7 @@ void LinkedScene::writeSet( const SceneInterface::Name &name, const IECore::Path path( p ); std::string strPath; SceneInterface::pathToString( p, strPath ); - throw IECore::Exception( boost::str( boost::format( "Unable to write set to linked scene location: '%1%'" ) % strPath ) ); + throw IECore::Exception( fmt::format( "Unable to write set to linked scene location: '{}'", strPath ) ); } else { diff --git a/src/IECoreScene/MeshAlgoDeleteFaces.cpp b/src/IECoreScene/MeshAlgoDeleteFaces.cpp index 562b52b12c..d83929fd83 100644 --- a/src/IECoreScene/MeshAlgoDeleteFaces.cpp +++ b/src/IECoreScene/MeshAlgoDeleteFaces.cpp @@ -195,7 +195,8 @@ MeshPrimitivePtr deleteFaces( const MeshPrimitive *meshPrimitive, PrimitiveVaria if( !meshPrimitive->isPrimitiveVariableValid( it->second ) ) { throw InvalidArgumentException( - boost::str ( boost::format( "MeshAlgo::deleteFaces cannot process invalid primitive variable \"%s\"" ) % it->first ) ); + fmt::format( "MeshAlgo::deleteFaces cannot process invalid primitive variable \"{}\"", it->first ) + ); } switch( it->second.interpolation ) diff --git a/src/IECoreScene/MeshAlgoDistortions.cpp b/src/IECoreScene/MeshAlgoDistortions.cpp index d29b8c721b..45512403df 100644 --- a/src/IECoreScene/MeshAlgoDistortions.cpp +++ b/src/IECoreScene/MeshAlgoDistortions.cpp @@ -205,22 +205,19 @@ std::pair MeshAlgo::calculateDistortion( c const V3fVectorData *pData = mesh->variableData( position, PrimitiveVariable::Vertex ); if( !pData ) { - string e = boost::str( boost::format( "MeshAlgo::calculateDistortion : MeshPrimitive has no suitable \"%s\" primitive variable." ) % position ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateDistortion : MeshPrimitive has no suitable \"{}\" primitive variable.", position ) ); } const V3fVectorData *pRefData = mesh->variableData( referencePosition, PrimitiveVariable::Vertex ); if( !pRefData ) { - string e = boost::str( boost::format( "MeshAlgo::calculateDistortion : MeshPrimitive has no suitable \"%s\" primitive variable." ) % referencePosition ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateDistortion : MeshPrimitive has no suitable \"{}\" primitive variable.", referencePosition ) ); } PrimitiveVariableMap::const_iterator uvIt = mesh->variables.find( uvSet ); if( uvIt == mesh->variables.end() || uvIt->second.interpolation != PrimitiveVariable::FaceVarying || uvIt->second.data->typeId() != V2fVectorDataTypeId ) { - string e = boost::str( boost::format( "MeshAlgo::calculateDistortion : MeshPrimitive has no suitable \"%s\" primitive variable." ) % uvSet ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateDistortion : MeshPrimitive has no suitable \"{}\" primitive variable.", uvSet ) ); } Canceller::check( canceller ); diff --git a/src/IECoreScene/MeshAlgoDistributePoints.cpp b/src/IECoreScene/MeshAlgoDistributePoints.cpp index ea0cca55ee..e99dc84fad 100644 --- a/src/IECoreScene/MeshAlgoDistributePoints.cpp +++ b/src/IECoreScene/MeshAlgoDistributePoints.cpp @@ -291,10 +291,9 @@ void processInputs( } if( !uvVar.data ) { - std::string e = boost::str( boost::format( - "MeshAlgo::distributePoints : MeshPrimitive has no uv primitive variable named \"%s\" of type FaceVarying or Vertex." ) - % uvSet ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::distributePoints : MeshPrimitive has no uv primitive variable named \"{}\" of type FaceVarying or Vertex.", uvSet ) + ); } faceAreaVar = MeshAlgo::calculateFaceArea( processedMesh.get(), refPosition, canceller ); @@ -365,10 +364,12 @@ void distributePointsInTriangle( const float approxCandidatePoints = uvBounds.size().x * uvBounds.size().y * textureDensity; if( ! ( approxCandidatePoints <= maxCandidatePoints ) ) { - std::string e = boost::str( boost::format( - "MeshAlgo::distributePoints : Cannot generate more than %i candidate points per polygon. Trying to generate %i. There are circumstances where the output would be reasonable, but this happens during processing due to a polygon with a large area in 3D space which is extremely thin in UV space, in which case you may need to clean your UVs. Alternatively, maybe you really want to put an extraordinary number of points on one polygon - please subdivide it before distributing points to help with performance." ) - % size_t( maxCandidatePoints ) % size_t( approxCandidatePoints ) ); - throw Exception( e ); + throw Exception( + fmt::format( + "MeshAlgo::distributePoints : Cannot generate more than {} candidate points per polygon. Trying to generate {}. There are circumstances where the output would be reasonable, but this happens during processing due to a polygon with a large area in 3D space which is extremely thin in UV space, in which case you may need to clean your UVs. Alternatively, maybe you really want to put an extraordinary number of points on one polygon - please subdivide it before distributing points to help with performance.", + size_t( maxCandidatePoints ), size_t( approxCandidatePoints ) + ) + ); } int cancelCounter = 0; diff --git a/src/IECoreScene/MeshAlgoFaceArea.cpp b/src/IECoreScene/MeshAlgoFaceArea.cpp index 3c6ffc9a96..eafb61e353 100644 --- a/src/IECoreScene/MeshAlgoFaceArea.cpp +++ b/src/IECoreScene/MeshAlgoFaceArea.cpp @@ -37,7 +37,6 @@ #include "IECore/PolygonAlgo.h" -#include "boost/format.hpp" #include "boost/iterator/transform_iterator.hpp" #include "boost/iterator/zip_iterator.hpp" #include "boost/tuple/tuple.hpp" @@ -70,7 +69,7 @@ PrimitiveVariable MeshAlgo::calculateFaceArea( const MeshPrimitive *mesh, const const V3fVectorData *pData = mesh->variableData( position, PrimitiveVariable::Vertex ); if( !pData ) { - throw InvalidArgumentException( boost::str( boost::format( "MeshAlgo::calculateFaceArea : MeshPrimitive has no \"%s\" primitive variable." ) % position ) ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateFaceArea : MeshPrimitive has no \"{}\" primitive variable.", position ) ); } const std::vector &p = pData->readable(); @@ -103,7 +102,7 @@ PrimitiveVariable MeshAlgo::calculateFaceTextureArea( const MeshPrimitive *mesh, uvView = mesh->variableIndexedView( uvSet, PrimitiveVariable::FaceVarying, false ); if( !uvView ) { - throw InvalidArgumentException( boost::str( boost::format( "MeshAlgo::calculateFaceTextureArea : MeshPrimitive has no suitable \"%s\" primitive variable." ) % uvSet ) ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateFaceTextureArea : MeshPrimitive has no suitable \"{}\" primitive variable.", uvSet ) ); } uvInterpolation = PrimitiveVariable::FaceVarying; } diff --git a/src/IECoreScene/MeshAlgoMerge.cpp b/src/IECoreScene/MeshAlgoMerge.cpp index 955c5ebe8f..d89d30264f 100644 --- a/src/IECoreScene/MeshAlgoMerge.cpp +++ b/src/IECoreScene/MeshAlgoMerge.cpp @@ -38,8 +38,6 @@ #include "IECore/DataAlgo.h" #include "IECore/DespatchTypedData.h" -#include "boost/format.hpp" - #include using namespace Imath; diff --git a/src/IECoreScene/MeshAlgoNormals.cpp b/src/IECoreScene/MeshAlgoNormals.cpp index a099b0fdf0..6dbd79c5c5 100644 --- a/src/IECoreScene/MeshAlgoNormals.cpp +++ b/src/IECoreScene/MeshAlgoNormals.cpp @@ -37,7 +37,6 @@ #include "IECore/PolygonAlgo.h" -#include "boost/format.hpp" #include "boost/iterator/transform_iterator.hpp" #include "boost/iterator/zip_iterator.hpp" #include "boost/tuple/tuple.hpp" @@ -142,7 +141,7 @@ PrimitiveVariable calculateNormalsImpl( const MeshPrimitive *mesh, PrimitiveVari const V3fVectorData *pData = mesh->variableData( position, PrimitiveVariable::Vertex ); if( !pData ) { - throw InvalidArgumentException( boost::str( boost::format( "MeshAlgo::calculateNormals : MeshPrimitive has no \"%s\" primitive variable." ) % position ) ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateNormals : MeshPrimitive has no \"{}\" primitive variable.", position ) ); } const std::vector &points = pData->readable(); @@ -329,7 +328,7 @@ PrimitiveVariable calculateNormalsImpl( const MeshPrimitive *mesh, PrimitiveVari // test all pairs of face-verts for whether they match. The only reasonable cases for a // vertex like this involve radial symmetry, so we'll just test one arbitrarily chosen // vert against every other vert, and treat the vertex either as fully smooth - // ( appropriate for the pole of a sphere ) or fully hard edged ( appropriate for the tip of + // ( appropriate for the pole of a sphere ) or fully hard edged ( appropriate for the tip of // a cone ) bool allMatch = true; @@ -479,7 +478,7 @@ PrimitiveVariable MeshAlgo::calculateNormals( const MeshPrimitive *mesh, Primiti const V3fVectorData *pData = mesh->variableData( position, PrimitiveVariable::Vertex ); if( !pData ) { - throw InvalidArgumentException( boost::str( boost::format( "MeshAlgo::calculateNormals : MeshPrimitive has no \"%s\" primitive variable." ) % position ) ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::calculateNormals : MeshPrimitive has no \"{}\" primitive variable.", position ) ); } const std::vector &points = pData->readable(); diff --git a/src/IECoreScene/MeshAlgoReorder.cpp b/src/IECoreScene/MeshAlgoReorder.cpp index 190f32f228..6eec2e4478 100644 --- a/src/IECoreScene/MeshAlgoReorder.cpp +++ b/src/IECoreScene/MeshAlgoReorder.cpp @@ -90,8 +90,7 @@ struct ReorderFn DataPtr operator()( Data *d, const std::string &name ) { - string e = boost::str( boost::format( "MeshAlgo::reorderVertices : \"%s\" has unsupported data type \"%s\"." ) % name % d->typeName() ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::reorderVertices : \"{}\" has unsupported data type \"{}\".", name, d->typeName() ) ); } private: @@ -396,19 +395,19 @@ void MeshAlgo::reorderVertices( MeshPrimitive *mesh, int id0, int id1, int id2, VertexToFacesMap::const_iterator vIt0 = vertexToFacesMap.find( id0 ); if( vIt0 == vertexToFacesMap.end() ) { - throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Cannot find vertex %d" ) % id0 ).str() ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::reorderVertices : Cannot find vertex {}", id0 ) ); } VertexToFacesMap::const_iterator vIt1 = vertexToFacesMap.find( id1 ); if( vIt1 == vertexToFacesMap.end() ) { - throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Cannot find vertex %d" ) % id1 ).str() ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::reorderVertices : Cannot find vertex {}", id1 ) ); } VertexToFacesMap::const_iterator vIt2 = vertexToFacesMap.find( id2 ); if( vIt2 == vertexToFacesMap.end() ) { - throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Cannot find vertex %d" ) % id2 ).str() ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::reorderVertices : Cannot find vertex {}", id2 ) ); } FaceSet tmp; @@ -432,7 +431,7 @@ void MeshAlgo::reorderVertices( MeshPrimitive *mesh, int id0, int id1, int id2, if( tmp2.size() != 1 ) { - throw InvalidArgumentException( ( boost::format( "MeshAlgo::reorderVertices : Vertices %d, %d, and %d do not uniquely define a single polygon" ) % id0 % id1 % id2 ).str() ); + throw InvalidArgumentException( fmt::format( "MeshAlgo::reorderVertices : Vertices {}, {}, and {} do not uniquely define a single polygon", id0, id1, id2 ) ); } int currentFace = *tmp2.begin(); diff --git a/src/IECoreScene/MeshAlgoSegment.cpp b/src/IECoreScene/MeshAlgoSegment.cpp index 8fa7a65241..46a31f3480 100644 --- a/src/IECoreScene/MeshAlgoSegment.cpp +++ b/src/IECoreScene/MeshAlgoSegment.cpp @@ -32,8 +32,6 @@ // ////////////////////////////////////////////////////////////////////////// -#include "boost/format.hpp" - #include "IECore/DataAlgo.h" #include "IECoreScene/MeshAlgo.h" diff --git a/src/IECoreScene/MeshAlgoTangents.cpp b/src/IECoreScene/MeshAlgoTangents.cpp index 77d36bf344..22a8500951 100644 --- a/src/IECoreScene/MeshAlgoTangents.cpp +++ b/src/IECoreScene/MeshAlgoTangents.cpp @@ -94,8 +94,9 @@ std::pair IECoreScene::MeshAlgo::calculate const V3fVectorData *positionData = mesh->variableData( position ); if( !positionData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromUV : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % position ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromUV : MeshPrimitive has no Vertex \"{}\" primitive variable.", position ) + ); } const V3fVectorData::ValueType &points = positionData->readable(); @@ -109,7 +110,9 @@ std::pair IECoreScene::MeshAlgo::calculate const auto uvIt = mesh->variables.find( uvSet ); if( uvIt == mesh->variables.end() || uvIt->second.data->typeId() != V2fVectorDataTypeId ) { - throw InvalidArgumentException( ( boost::format( "MeshAlgo::calculateTangentsFromUV : MeshPrimitive has no V2fVectorData primitive variable named \"%s\"." ) % ( uvSet ) ).str() ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromUV : MeshPrimitive has no V2fVectorData primitive variable named \"{}\".", uvSet ) + ); } const std::vector *uvData = nullptr; @@ -152,11 +155,10 @@ std::pair IECoreScene::MeshAlgo::calculate else { throw InvalidArgumentException( - ( - boost::format( - "MeshAlgo::calculateTangentsFromUV : MeshPrimitive primitive variable named \"%s\" has incorrect interpolation, must be either Vertex or FaceVarying" - ) % ( uvSet ) - ).str() + fmt::format( + "MeshAlgo::calculateTangentsFromUV : MeshPrimitive primitive variable named \"{}\" has incorrect interpolation, must be either Vertex or FaceVarying", + uvSet + ) ); } @@ -292,20 +294,23 @@ std::pair IECoreScene::MeshAlgo::calculate const V3fVectorData *normalData = mesh->variableData( normal ); if( !positionData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % position ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : MeshPrimitive has no Vertex \"{}\" primitive variable.", position ) + ); } if( !normalData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % normal ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : MeshPrimitive has no Vertex \"{}\" primitive variable.", normal ) + ); } const auto normalIt = mesh->variables.find( normal ); if( normalIt == mesh->variables.end() || normalIt->second.interpolation != IECoreScene::PrimitiveVariable::Interpolation::Vertex ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : The normal primitive variable \"%s\" needs to be Vertex interpolated." ) % normal ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : The normal primitive variable \"{}\" needs to be Vertex interpolated.", normal ) + ); } const V3fVectorData::ValueType &points = positionData->readable(); @@ -399,8 +404,9 @@ std::pair IECoreScene::MeshAlgo::calculate const V3fVectorData *positionData = mesh->variableData( position ); if( !positionData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromFirstEdge : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % position ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromFirstEdge : MeshPrimitive has no Vertex \"{}\" primitive variable.", position ) + ); } const V3fVectorData::ValueType &points = positionData->readable(); @@ -408,14 +414,16 @@ std::pair IECoreScene::MeshAlgo::calculate const V3fVectorData *normalData = mesh->variableData( normal ); if( !normalData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromFirstEdge : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % normal ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromFirstEdge : MeshPrimitive has no Vertex \"{}\" primitive variable.", normal ) + ); } const auto normalIt = mesh->variables.find( normal ); if( normalIt == mesh->variables.end() || normalIt->second.interpolation != IECoreScene::PrimitiveVariable::Interpolation::Vertex ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : The normal primitive variable \"%s\" needs to be Vertex interpolated." ) % normal ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : The normal primitive variable \"{}\" needs to be Vertex interpolated.", normal ) + ); } const auto &normals = normalData->readable(); @@ -485,8 +493,9 @@ std::pair IECoreScene::MeshAlgo::calculate const V3fVectorData *positionData = mesh->variableData( position ); if( !positionData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromTwoEdges : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % position ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromTwoEdges : MeshPrimitive has no Vertex \"{}\" primitive variable.", position ) + ); } const V3fVectorData::ValueType &points = positionData->readable(); @@ -494,14 +503,16 @@ std::pair IECoreScene::MeshAlgo::calculate const V3fVectorData *normalData = mesh->variableData( normal ); if( !normalData ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromTwoEdges : MeshPrimitive has no Vertex \"%s\" primitive variable." ) % normal ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromTwoEdges : MeshPrimitive has no Vertex \"{}\" primitive variable.", normal ) + ); } const auto normalIt = mesh->variables.find( normal ); if( normalIt == mesh->variables.end() || normalIt->second.interpolation != IECoreScene::PrimitiveVariable::Interpolation::Vertex ) { - std::string e = boost::str( boost::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : The normal primitive variable \"%s\" needs to be Vertex interpolated." ) % normal ); - throw InvalidArgumentException( e ); + throw InvalidArgumentException( + fmt::format( "MeshAlgo::calculateTangentsFromPrimitiveCentroid : The normal primitive variable \"{}\" needs to be Vertex interpolated.", normal ) + ); } const auto &normals = normalData->readable(); diff --git a/src/IECoreScene/MeshAlgoTriangulate.cpp b/src/IECoreScene/MeshAlgoTriangulate.cpp index eab35c0a5d..c4b9b46707 100644 --- a/src/IECoreScene/MeshAlgoTriangulate.cpp +++ b/src/IECoreScene/MeshAlgoTriangulate.cpp @@ -293,10 +293,10 @@ struct TriangulateFn assert( data ); throw InvalidArgumentException( - ( - boost::format( "MeshAlgo::triangulate: Invalid data type \"%s\" for primitive variable \"P\"." ) % - Object::typeNameFromTypeId( data->typeId() ) - ).str() + fmt::format( + "MeshAlgo::triangulate: Invalid data type \"{}\" for primitive variable \"P\".", + Object::typeNameFromTypeId( data->typeId() ) + ) ); } }; diff --git a/src/IECoreScene/MeshNormalsOp.cpp b/src/IECoreScene/MeshNormalsOp.cpp index eb4a6924fe..587f503c87 100644 --- a/src/IECoreScene/MeshNormalsOp.cpp +++ b/src/IECoreScene/MeshNormalsOp.cpp @@ -38,8 +38,6 @@ #include "IECore/CompoundParameter.h" #include "IECore/DespatchTypedData.h" -#include "boost/format.hpp" - using namespace IECore; using namespace IECoreScene; using namespace std; diff --git a/src/IECoreScene/MeshPrimitive.cpp b/src/IECoreScene/MeshPrimitive.cpp index 1567c4500e..ebaf33ead4 100644 --- a/src/IECoreScene/MeshPrimitive.cpp +++ b/src/IECoreScene/MeshPrimitive.cpp @@ -39,8 +39,6 @@ #include "IECore/ClassData.h" #include "IECore/MurmurHash.h" -#include "boost/format.hpp" - #include "tbb/spin_rw_mutex.h" #include @@ -284,20 +282,17 @@ void MeshPrimitive::setCorners( const IECore::IntVectorData *ids, const IECore:: { if( id < 0 || (size_t)id >= m_numVertices ) { - throw Exception( boost::str( - boost::format( - "Bad corners : id (%1%) is out of expected range (0-%2%)" - ) % id % (m_numVertices - 1) + throw Exception( fmt::format( + "Bad corners : id ({}) is out of expected range (0-{})", id, (m_numVertices - 1) ) ); } } if( sharpnesses->readable().size() != ids->readable().size() ) { - throw Exception( boost::str( - boost::format( - "Bad corners : number of sharpnesses (%1%) does not match number of ids (%2%)" - ) % sharpnesses->readable().size() % ids->readable().size() + throw Exception( fmt::format( + "Bad corners : number of sharpnesses ({}) does not match number of ids ({})", + sharpnesses->readable().size(), ids->readable().size() ) ); } @@ -328,10 +323,8 @@ void MeshPrimitive::setCreases( const IECore::IntVectorData *lengths, const IECo { if( length < 2 ) { - throw Exception( boost::str( - boost::format( - "Bad creases : length (%1%) is less than 2" - ) % length + throw Exception( fmt::format( + "Bad creases : length ({}) is less than 2", length ) ); } expectedIds += length; @@ -339,10 +332,8 @@ void MeshPrimitive::setCreases( const IECore::IntVectorData *lengths, const IECo if( ids->readable().size() != expectedIds ) { - throw Exception( boost::str( - boost::format( - "Bad creases : expected %1% ids but given %2%" - ) % expectedIds % ids->readable().size() + throw Exception( fmt::format( + "Bad creases : expected {} ids but given {}", expectedIds, ids->readable().size() ) ); } @@ -350,20 +341,17 @@ void MeshPrimitive::setCreases( const IECore::IntVectorData *lengths, const IECo { if( id < 0 || (size_t)id >= m_numVertices ) { - throw Exception( boost::str( - boost::format( - "Bad creases : id (%1%) is out of expected range (0-%2%)" - ) % id % (m_numVertices - 1) + throw Exception( fmt::format( + "Bad creases : id ({}) is out of expected range (0-{})", id, (m_numVertices - 1) ) ); } } if( sharpnesses->readable().size() != lengths->readable().size() ) { - throw Exception( boost::str( - boost::format( - "Bad creases : number of sharpnesses (%1%) does not match number of lengths (%2%)" - ) % sharpnesses->readable().size() % lengths->readable().size() + throw Exception( fmt::format( + "Bad creases : number of sharpnesses ({}) does not match number of lengths ({})", + sharpnesses->readable().size(), lengths->readable().size() ) ); } diff --git a/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp b/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp index 558c49b229..49771d8ba2 100644 --- a/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp +++ b/src/IECoreScene/MeshPrimitiveShrinkWrapOp.cpp @@ -45,8 +45,6 @@ #include "IECore/VectorOps.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - using namespace IECore; using namespace IECoreScene; using namespace Imath; @@ -186,7 +184,7 @@ struct MeshPrimitiveShrinkWrapOp::ShrinkWrapFn { if ( !directionVerticesData ) { - throw InvalidArgumentException( (boost::format("MeshPrimitiveShrinkWrapOp: Direction mesh has no primitive variable \"P\" of type \"%s\" ") % T::staticTypeName() ).str() ); + throw InvalidArgumentException( fmt::format( "MeshPrimitiveShrinkWrapOp: Direction mesh has no primitive variable \"P\" of type \"{}\"", T::staticTypeName() ) ); } else if ( directionVerticesData->readable().size() != vertices.size() ) { @@ -316,7 +314,7 @@ struct MeshPrimitiveShrinkWrapOp::ShrinkWrapFn { assert( data ); - throw InvalidArgumentException( ( boost::format( "MeshPrimitiveShrinkWrapOp: Invalid data type \"%s\" for primitive variable \"P\"." ) % Object::typeNameFromTypeId( data->typeId() ) ).str() ); + throw InvalidArgumentException( fmt::format( "MeshPrimitiveShrinkWrapOp: Invalid data type \"{}\" for primitive variable \"P\".", Object::typeNameFromTypeId( data->typeId() ) ) ); } }; }; diff --git a/src/IECoreScene/MeshVertexReorderOp.cpp b/src/IECoreScene/MeshVertexReorderOp.cpp index 3fb871f5e6..a6713c6525 100755 --- a/src/IECoreScene/MeshVertexReorderOp.cpp +++ b/src/IECoreScene/MeshVertexReorderOp.cpp @@ -38,8 +38,6 @@ #include "IECore/CompoundParameter.h" #include "IECore/DespatchTypedData.h" -#include "boost/format.hpp" - using namespace IECore; using namespace IECoreScene; using namespace std; diff --git a/src/IECoreScene/NParticleReader.cpp b/src/IECoreScene/NParticleReader.cpp index 6590218c06..1ce327aaba 100644 --- a/src/IECoreScene/NParticleReader.cpp +++ b/src/IECoreScene/NParticleReader.cpp @@ -187,7 +187,7 @@ size_t NParticleReader::numParticles() std::map::const_iterator frameIt = frameToRootChildren.find( frame ); if( frameIt == frameToRootChildren.end() ) { - msg( Msg::Warning, "NParticleReader::attributeNames()", boost::format( "Frame '%d' (index '%d') does not exist in '%s'." ) % frame % frameIndex % m_iffFileName ); + msg( Msg::Warning, "NParticleReader::attributeNames()", "Frame '{}' (index '{}') does not exist in '{}'.", frame, frameIndex, m_iffFileName ); return 0; } @@ -219,7 +219,7 @@ void NParticleReader::attributeNames( std::vector &names ) std::map::const_iterator frameIt = frameToRootChildren.find( frame ); if( frameIt == frameToRootChildren.end() ) { - msg( Msg::Warning, "NParticleReader::attributeNames()", boost::format( "Frame '%d' (index '%d') does not exist in '%s'." ) % frame % frameIndex % m_iffFileName ); + msg( Msg::Warning, "NParticleReader::attributeNames()", "Frame '{}' (index '{}') does not exist in '{}'.", frame, frameIndex, m_iffFileName ); return; } @@ -241,7 +241,7 @@ const IntVectorData * NParticleReader::frameTimes() { if ( !open() ) { - msg( Msg::Error, "NParticleReader::attributeNames()", boost::format( "Failed to open '%s'." ) % m_iffFileName ); + msg( Msg::Error, "NParticleReader::attributeNames()", "Failed to open '{}'.", m_iffFileName ); return nullptr; } @@ -298,7 +298,7 @@ DataPtr NParticleReader::readAttribute( const std::string &name ) std::map::const_iterator frameIt = frameToRootChildren.find( frame ); if( frameIt == frameToRootChildren.end() ) { - msg( Msg::Warning, "NParticleReader::readAttribute()", boost::format( "Frame '%d' (index '%d') does not exist in '%s'." ) % frame % frameIndex % m_iffFileName ); + msg( Msg::Warning, "NParticleReader::readAttribute()", "Frame '{}' (index '{}') does not exist in '{}'.", frame, frameIndex, m_iffFileName ); return nullptr; } @@ -333,7 +333,7 @@ DataPtr NParticleReader::readAttribute( const std::string &name ) int id = it->type().id(); if ( id != kSIZE && id != kDBLA && id != kDVCA && id != kFVCA ) { - msg( Msg::Warning, "NParticleReader::readAttribute()", boost::format( "CHNM '%s' found, but was followed by invalid Tag '%s'." ) % name % it->type().name() ); + msg( Msg::Warning, "NParticleReader::readAttribute()", "CHNM '{}' found, but was followed by invalid Tag '{}'.", name, it->type().name() ); return nullptr; } } @@ -403,7 +403,7 @@ DataPtr NParticleReader::readAttribute( const std::string &name ) } break; default : - msg( Msg::Error, "NParticleReader::readAttribute()", boost::format( "CHNM '%s' found, but was followed by invalid Tag '%s'." ) % name % (attrIt+2)->type().name() ); + msg( Msg::Error, "NParticleReader::readAttribute()", "CHNM '{}' found, but was followed by invalid Tag '{}'.", name, (attrIt+2)->type().name() ); } return result; diff --git a/src/IECoreScene/PDCParticleWriter.cpp b/src/IECoreScene/PDCParticleWriter.cpp index c306fbc834..073d9ecf5b 100644 --- a/src/IECoreScene/PDCParticleWriter.cpp +++ b/src/IECoreScene/PDCParticleWriter.cpp @@ -42,8 +42,6 @@ #include "IECore/MessageHandler.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - #include using namespace IECore; @@ -117,7 +115,7 @@ void PDCParticleWriter::doWrite( const CompoundObject *operands ) ofstream oStream( fileName().c_str(), std::ios_base::binary | std::ios_base::out ); if( !oStream.is_open() ) { - throw IOException( ( format( "Unable to open file \"%s\"." ) % fileName() ).str() ); + throw IOException( fmt::format( "Unable to open file \"{}\".", fileName() ) ); } char pdc[4] = { 'P', 'D', 'C', ' ' }; diff --git a/src/IECoreScene/PointsAlgo.cpp b/src/IECoreScene/PointsAlgo.cpp index 46fc665754..ea2a7fc2f0 100644 --- a/src/IECoreScene/PointsAlgo.cpp +++ b/src/IECoreScene/PointsAlgo.cpp @@ -43,8 +43,6 @@ #include "IECore/DespatchTypedData.h" #include "IECore/TypeTraits.h" -#include "boost/format.hpp" - #include using namespace IECore; @@ -126,7 +124,8 @@ PointsPrimitivePtr deletePoints( const PointsPrimitive *pointsPrimitive, IECoreS if( !pointsPrimitive->isPrimitiveVariableValid( it->second ) ) { throw InvalidArgumentException( - boost::str ( boost::format( "PointsAlgo::deletePoints cannot process invalid primitive variable \"%s\"" ) % it->first ) ); + fmt::format( "PointsAlgo::deletePoints cannot process invalid primitive variable \"{}\"", it->first ) + ); } const IECore::Data *inputData = it->second.data.get(); vertexFunctor.setIndices( it->second.indices.get() ); @@ -303,7 +302,7 @@ PointsPrimitivePtr deletePoints( const PointsPrimitive *pointsPrimitive, const P if( pointsToDelete.interpolation != PrimitiveVariable::Vertex ) { throw InvalidArgumentException( - boost::str ( boost::format( "PointsAlgo::deletePoints requires a Vertex [Int|Bool|Float]VectorData primitiveVariable. %1% interpolation found " ) % pointsToDelete.interpolation ) + fmt::format( "PointsAlgo::deletePoints requires a Vertex [Int|Bool|Float]VectorData primitiveVariable. {} interpolation found", pointsToDelete.interpolation ) ); } @@ -362,8 +361,7 @@ PointsPrimitivePtr mergePoints( const std::vector &poin { if( bExistingVertex ) { - std::string msg = boost::str( boost::format( "PointsAlgo::mergePoints mismatching primvar %s" ) % name ); - throw InvalidArgumentException( msg ); + throw InvalidArgumentException( fmt::format( "PointsAlgo::mergePoints mismatching primvar {}", name ) ); } if( !bExistingConstant ) @@ -379,8 +377,7 @@ PointsPrimitivePtr mergePoints( const std::vector &poin PrimitiveVariableMap::const_iterator constantPrimVarIt = constantPrimVars.find( name ); if( constantPrimVarIt != constantPrimVars.end() ) { - std::string msg = boost::str( boost::format( "PointsAlgo::mergePoints mismatching primvar %s" ) % name ); - throw InvalidArgumentException( msg ); + throw InvalidArgumentException( fmt::format( "PointsAlgo::mergePoints mismatching primvar {}", name ) ); } if( !bExistingVertex ) @@ -403,8 +400,7 @@ PointsPrimitivePtr mergePoints( const std::vector &poin } catch( const IECore::Exception &e ) { - std::string msg = boost::str( boost::format( "PointsAlgo::mergePoints unable to cast primvar %s (%s) " ) % name % e.what() ); - throw InvalidArgumentException( msg ); + throw InvalidArgumentException( fmt::format( "PointsAlgo::mergePoints unable to cast primvar {} ({})", name, e.what() ) ); } } } diff --git a/src/IECoreScene/PrimitiveInterpolator.cpp b/src/IECoreScene/PrimitiveInterpolator.cpp index 64928a982c..69ea3aaafd 100644 --- a/src/IECoreScene/PrimitiveInterpolator.cpp +++ b/src/IECoreScene/PrimitiveInterpolator.cpp @@ -84,13 +84,9 @@ PrimitivePtr interpolatePrimitive( const Primitive *y0, const Primitive *y1, dou if( y0Size != y1Size ) { msg( - MessageHandler::Level::Error, "interpolatePrimitive", boost::str( - boost::format( "primitive variable '%s' data array size changes between primitives. ( primitive0 size: %i, primitive1 size: %i, alpha: %f )" ) % - it->first % - y0Size % - y1Size % - x - ) + MessageHandler::Level::Error, "interpolatePrimitive", + "primitive variable '{}' data array size changes between primitives. ( primitive0 size: {}, primitive1 size: {}, alpha: {:f} )", + it->first, y0Size, y1Size, x ); continue; } @@ -108,7 +104,7 @@ PrimitivePtr interpolatePrimitive( const Primitive *y0, const Primitive *y1, dou msg( MessageHandler::Level::Error, "interpolatePrimitive", - boost::str( boost::format( "primitive variable '%s' index ordering changes between primitives" ) % it->first ) + "primitive variable '{}' index ordering changes between primitives", it->first ); continue; } @@ -120,7 +116,7 @@ PrimitivePtr interpolatePrimitive( const Primitive *y0, const Primitive *y1, dou msg( MessageHandler::Level::Error, "interpolatePrimitive", - boost::str( boost::format( "primitive variable '%s' indexing changes between primitives" ) % it->first ) + "primitive variable '{}' indexing changes between primitives", it->first ); continue; } diff --git a/src/IECoreScene/SceneCache.cpp b/src/IECoreScene/SceneCache.cpp index 37a22ed4aa..84d8493a94 100644 --- a/src/IECoreScene/SceneCache.cpp +++ b/src/IECoreScene/SceneCache.cpp @@ -58,6 +58,8 @@ #include "tbb/concurrent_hash_map.h" +#include "fmt/format.h" + using namespace IECore; using namespace IECoreScene; using namespace Imath; @@ -521,7 +523,7 @@ class SceneCache::ReaderImplementation : public SceneCache::Implementation if ( !it.first->second ) { m_attributeSampleTimes.erase( it.first ); - throw Exception( ( boost::format( "No samples for attribute %s available" ) % name.value() ).str() ); + throw Exception( fmt::format( "No samples for attribute {} available", name.value() ) ); } return *(it.first->second); } @@ -1009,7 +1011,7 @@ class SceneCache::ReaderImplementation : public SceneCache::Implementation { if ( throwExceptions ) { - throw Exception( (boost::format("No %s samples available") % childName.value()).str() ); + throw Exception( fmt::format( "No {} samples available", childName.value() ) ); } return nullptr; } @@ -1221,7 +1223,7 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation } catch ( std::exception &e ) { - msg( Msg::Error, "SceneCache::~SceneCache", ( boost::format( "Corrupted file resulted from exception while flushing data: %s." ) % e.what() ).str() ); + msg( Msg::Error, "SceneCache::~SceneCache", "Corrupted file resulted from exception while flushing data: {}.", e.what() ); } catch (...) { @@ -1262,10 +1264,9 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation if ( *(m_boundSampleTimes.rbegin()) >= time ) { std::string prefix = "SceneCache::writeBound"; - std::string details = boost::str( - boost::format( - "bound written at previous time: %1%,\nSample times must be written sequentially for each bound." - ) % *(m_boundSampleTimes.rbegin()) + std::string details = fmt::format( + "bound written at previous time: {},\nSample times must be written sequentially for each bound.", + *(m_boundSampleTimes.rbegin()) ); throwException( prefix, time, details ); } @@ -1300,10 +1301,9 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation if ( *(m_transformSampleTimes.rbegin()) >= time ) { std::string prefix = "SceneCache::writeTransform"; - std::string details = boost::str( - boost::format( - "transform written at previous time: %1%,\nSample times must be written sequentially for each transform." - ) % *(m_transformSampleTimes.rbegin()) + std::string details = fmt::format( + "transform written at previous time: {},\nSample times must be written sequentially for each transform.", + *(m_transformSampleTimes.rbegin()) ); throwException( prefix, time, details ); } @@ -1321,7 +1321,7 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation if ( !attribute ) { - throw Exception( boost::str( boost::format( "SceneCache::writeAttribute ( name: '%1%' ): NULL attribute data! ") % name.string() ) ); + throw Exception( fmt::format( "SceneCache::writeAttribute (name: '{}'): NULL attribute data!", name ) ); } std::pair< AttributeSamplesMap::iterator, bool > it = m_attributeSampleTimes.insert( std::pair< SceneCache::Name, SampleTimes >( name, SampleTimes() ) ); @@ -1331,10 +1331,9 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation if ( *(sampleTimes.rbegin()) >= time ) { std::string prefix = "SceneCache::writeAttribute"; - std::string details = boost::str( - boost::format( - "name: '%1%' written at previous time: %2%,\nSample times must be written sequentially for each attribute." - ) % name.string() % *(sampleTimes.rbegin()) + std::string details = fmt::format( + "name: '{}' written at previous time: {},\nSample times must be written sequentially for each attribute.", + name, *(sampleTimes.rbegin()) ); throwException( prefix, time, details ); } @@ -1403,10 +1402,9 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation if ( *(m_objectSampleTimes.rbegin()) >= time ) { std::string prefix = "SceneCache::writeObject"; - std::string details = boost::str( - boost::format( - "object written at previous time: %1%,\nSample times must be written sequentially for each object." - ) % *(m_objectSampleTimes.rbegin()) + std::string details = fmt::format( + "object written at previous time: %1%,\nSample times must be written sequentially for each object.", + *(m_objectSampleTimes.rbegin()) ); throwException( prefix, time, details ); } @@ -1582,7 +1580,7 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation { if ( !m_sampleTimesMap ) { - throw Exception( boost::str( boost::format( " '%1%' has already been flushed to disk. You can't make further changes to it." ) % fileName() ) ); + throw Exception( fmt::format( "'{}' has already been flushed to disk. You can't make further changes to it.", fileName() ) ); } } @@ -1763,7 +1761,7 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation path( p ); IECoreScene::SceneInterface::pathToString( p, stringPath ); std::string type = boost::core::demangle( typeid( e ).name() ); - throw IECore::IOException( boost::str( boost::format( "%1% : %2% ( for location \"%3%\" )" ) % type % e.what() % stringPath ) ); + throw IECore::IOException( fmt::format( "{} : {} (for location \"{}\")", type, e.what(), stringPath ) ); } catch( ... ) { @@ -1771,7 +1769,7 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation std::string stringPath; path( p ); IECoreScene::SceneInterface::pathToString( p, stringPath ); - throw IECore::IOException( boost::str( boost::format( "Unknown exception while flushing data ( for location %1% )" ) % stringPath ) ); + throw IECore::IOException( fmt::format( "Unknown exception while flushing data (for location {})", stringPath ) ); } } @@ -2181,10 +2179,9 @@ class SceneCache::WriterImplementation : public SceneCache::Implementation IECoreScene::SceneInterface::pathToString( p, stringPath ); throw Exception( - boost::str( - boost::format( - "%1% ( for location %2%, time: %3% ) : %4%" - ) % prefix % stringPath % time % details + fmt::format( + "{} (for location {}, time: {}) : {}", + prefix, stringPath, time, details ) ); } diff --git a/src/IECoreScene/ShaderNetwork.cpp b/src/IECoreScene/ShaderNetwork.cpp index ae3f97b4af..34377cfaee 100644 --- a/src/IECoreScene/ShaderNetwork.cpp +++ b/src/IECoreScene/ShaderNetwork.cpp @@ -183,11 +183,7 @@ class ShaderNetwork::Implementation auto it = m_nodes.find( handle ); if( it == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Shader \"%1%\" not in network" - ) % handle.c_str() - ) ); + throw IECore::Exception( fmt::format( "Shader \"{}\" not in network", handle ) ); } removeShader( it ); } @@ -217,32 +213,29 @@ class ShaderNetwork::Implementation auto sourceIt = m_nodes.find( connection.source.shader ); if( sourceIt == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Source shader \"%1%\" not in network" - ) % connection.source.shader.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Source shader \"{}\" not in network", connection.source.shader ) + ); } auto destinationIt = m_nodes.find( connection.destination.shader ); if( destinationIt == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Destination shader \"%1%\" not in network" - ) % connection.destination.shader.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Destination shader \"{}\" not in network", connection.destination.shader ) + ); } Connection c = connection; bool inserted = destinationIt->mutableInputConnections().insert( c ).second; if( !inserted ) { - throw IECore::Exception( boost::str( - boost::format( - "Destination parameter \"%1%.%2%\" already has a connection" - ) % connection.destination.shader.c_str() % connection.destination.name.c_str() - ) ); + throw IECore::Exception( + fmt::format( + "Destination parameter \"{}.{}\" already has a connection", + connection.destination.shader, connection.destination.name + ) + ); } inserted = sourceIt->mutableOutputConnections().insert( c ).second; assert( inserted ); @@ -255,21 +248,20 @@ class ShaderNetwork::Implementation auto destinationIt = m_nodes.find( connection.destination.shader ); if( destinationIt == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Destination shader \"%1%\" not in network" - ) % connection.destination.shader.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Destination shader \"{}\" not in network", connection.destination.shader ) + ); } auto connectionIt = destinationIt->inputConnections.find( connection.destination ); if( connectionIt == destinationIt->inputConnections.end() || *connectionIt != connection ) { - throw IECore::Exception( boost::str( - boost::format( - "Connection \"%1%.%2% -> %3%.%4%\" not in network" - ) % connection.source.shader.c_str() % connection.source.name.c_str() % connection.destination.shader.c_str() % connection.destination.name.c_str() - ) ); + throw IECore::Exception( + fmt::format( + "Connection \"{}.{} -> {}.{}\" not in network", + connection.source.shader, connection.source.name, connection.destination.shader, connection.destination.name + ) + ); } destinationIt->mutableInputConnections().erase( connectionIt ); @@ -286,11 +278,9 @@ class ShaderNetwork::Implementation auto destinationIt = m_nodes.find( destination.shader ); if( destinationIt == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Destination shader \"%1%\" not in network" - ) % destination.shader.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Destination shader \"{}\" not in network", destination.shader ) + ); } auto connectionIt = destinationIt->inputConnections.find( destination ); if( connectionIt == destinationIt->inputConnections.end() ) @@ -305,11 +295,9 @@ class ShaderNetwork::Implementation auto it = m_nodes.find( handle ); if( it == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Destination shader \"%1%\" not in network" - ) % handle.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Destination shader \"{}\" not in network", handle ) + ); } return ConnectionRange( @@ -323,11 +311,9 @@ class ShaderNetwork::Implementation auto it = m_nodes.find( handle ); if( it == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Source shader \"%1%\" not in network" - ) % handle.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Source shader \"{}\" not in network", handle ) + ); } return ConnectionRange( @@ -345,11 +331,9 @@ class ShaderNetwork::Implementation if( m_nodes.find( output.shader ) == m_nodes.end() ) { - throw IECore::Exception( boost::str( - boost::format( - "Output shader \"%1%\" not in network" - ) % output.shader.c_str() - ) ); + throw IECore::Exception( + fmt::format( "Output shader \"{}\" not in network", output.shader ) + ); } m_output = output; diff --git a/src/IECoreScene/ShaderNetworkAlgo.cpp b/src/IECoreScene/ShaderNetworkAlgo.cpp index cce2f3395f..09e73196e8 100644 --- a/src/IECoreScene/ShaderNetworkAlgo.cpp +++ b/src/IECoreScene/ShaderNetworkAlgo.cpp @@ -423,9 +423,10 @@ void ShaderNetworkAlgo::addComponentConnectionAdapters( ShaderNetwork *network, if( !parameterValue ) { throw IECore::Exception( - boost::str( boost::format( - "No value found for parameter `%1%.%2%`" - ) % shader.first % parameterName ) + fmt::format( + "No value found for parameter `{}.{}`", + shader.first, parameterName + ) ); } @@ -510,11 +511,12 @@ void ShaderNetworkAlgo::removeComponentConnectionAdapters( ShaderNetwork *networ ShaderNetwork::Parameter source = network->input( ShaderNetwork::Parameter( s.first, inParameter ) ); if( !source ) { - throw IECore::Exception( boost::str( - boost::format( - "removeComponentConnectionAdapters : \"%1%.%2%\" has no input" - ) % s.first.string() % inParameter.string() - ) ); + throw IECore::Exception( + fmt::format( + "removeComponentConnectionAdapters : \"{}.{}\" has no input", + s.first, inParameter + ) + ); } source.name = source.name.string() + "." + component.string(); diff --git a/src/IECoreScene/bindings/PrimitiveBinding.cpp b/src/IECoreScene/bindings/PrimitiveBinding.cpp index b2ed85a8f6..5488c1c517 100644 --- a/src/IECoreScene/bindings/PrimitiveBinding.cpp +++ b/src/IECoreScene/bindings/PrimitiveBinding.cpp @@ -41,6 +41,8 @@ #include "IECorePython/RunTimeTypedBinding.h" +#include "fmt/format.h" + using namespace boost::python; using namespace IECore; using namespace IECorePython; @@ -52,17 +54,17 @@ namespace #define IECORETEST_ASSERT( x ) \ if( !( x ) ) \ { \ - throw IECore::Exception( boost::str( \ - boost::format( "Failed assertion \"%s\" : %s line %d" ) % #x % __FILE__ % __LINE__ \ - ) ); \ + throw IECore::Exception( \ + fmt::format( "Failed assertion \"{}\" : {} line {}", #x, __FILE__, __LINE__ ) \ + ); \ } #define IECORETEST_ASSERT_MSG( x, msg ) \ if( !( x ) ) \ { \ - throw IECore::Exception( boost::str( \ - boost::format( "Failed assertion \"%s\" msg: '%s': %s line %d" ) % #x % msg % __FILE__ % __LINE__ \ - ) ); \ + throw IECore::Exception( \ + fmt::format( "Failed assertion \"{}\" msg: '{}': {} line {}", #x, msg, __FILE__, __LINE__ ) \ + ); \ } void testVariableIndexedView() diff --git a/src/IECoreScene/bindings/PrimitiveVariableBinding.cpp b/src/IECoreScene/bindings/PrimitiveVariableBinding.cpp index 23057af3cd..38e160660b 100644 --- a/src/IECoreScene/bindings/PrimitiveVariableBinding.cpp +++ b/src/IECoreScene/bindings/PrimitiveVariableBinding.cpp @@ -38,7 +38,7 @@ #include "IECoreScene/PrimitiveVariable.h" -#include "boost/format.hpp" +#include "fmt/format.h" using namespace std; using namespace boost::python; @@ -51,9 +51,9 @@ namespace #define IECORETEST_ASSERT( x ) \ if( !( x ) ) \ { \ - throw IECore::Exception( boost::str( \ - boost::format( "Failed assertion \"%s\" : %s line %d" ) % #x % __FILE__ % __LINE__ \ - ) ); \ + throw IECore::Exception( \ + fmt::format( "Failed assertion \"{}\" : {} line {}", #x, __FILE__, __LINE__ ) \ + ); \ } void testIndexedView() From 31ffcbae112bccb871b87dc4743d5a33755ad361 Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:57:17 -0800 Subject: [PATCH 08/10] IECoreGL : Prefer fmt::format --- src/IECoreGL/CachedConverter.cpp | 9 +++------ src/IECoreGL/ColorTexture.cpp | 4 +++- src/IECoreGL/Debug.cpp | 4 ++-- src/IECoreGL/DiskPrimitive.cpp | 2 +- src/IECoreGL/Display.cpp | 4 ++-- src/IECoreGL/FontLoader.cpp | 4 ++-- src/IECoreGL/HitRecord.cpp | 4 ++-- src/IECoreGL/IECoreGL.cpp | 10 ++++------ src/IECoreGL/NameStateComponent.cpp | 12 +++++------- src/IECoreGL/Primitive.cpp | 2 -- src/IECoreGL/Shader.cpp | 15 +++++++-------- src/IECoreGL/ShaderLoader.cpp | 7 ++++--- src/IECoreGL/SpherePrimitive.cpp | 2 +- src/IECoreGL/SplineToGLTextureConverter.cpp | 2 -- src/IECoreGL/Texture.cpp | 2 -- src/IECoreGL/TextureLoader.cpp | 14 +++++++------- src/IECoreGL/ToGLCameraConverter.cpp | 2 -- src/IECoreGL/ToGLCurvesConverter.cpp | 2 +- src/IECoreGL/ToGLMeshConverter.cpp | 4 +--- src/IECoreGL/ToGLPointsConverter.cpp | 4 ++-- src/IECoreGL/ToGLSphereConverter.cpp | 2 +- src/IECoreGL/ToGLStateConverter.cpp | 6 ++++-- src/IECoreGL/ToGLTextureConverter.cpp | 2 -- 23 files changed, 52 insertions(+), 67 deletions(-) diff --git a/src/IECoreGL/CachedConverter.cpp b/src/IECoreGL/CachedConverter.cpp index ab35c3d2a9..4316fa2c7f 100644 --- a/src/IECoreGL/CachedConverter.cpp +++ b/src/IECoreGL/CachedConverter.cpp @@ -41,11 +41,12 @@ #include "boost/bind/bind.hpp" #include "boost/bind/placeholders.hpp" -#include "boost/format.hpp" #include "boost/lexical_cast.hpp" #include "tbb/concurrent_queue.h" +#include "fmt/format.h" + using namespace boost::placeholders; using namespace IECoreGL; @@ -101,11 +102,7 @@ struct CachedConverter::MemberData if( !converter ) { throw IECore::Exception( - boost::str( - boost::format( - "Unable to create converter for Object of type \"%s\"" - ) % key.object->typeName() - ) + fmt::format( "Unable to create converter for Object of type \"{}\"", key.object->typeName() ) ); } return converter->convert(); diff --git a/src/IECoreGL/ColorTexture.cpp b/src/IECoreGL/ColorTexture.cpp index 919c0278e2..0da12cbd2a 100644 --- a/src/IECoreGL/ColorTexture.cpp +++ b/src/IECoreGL/ColorTexture.cpp @@ -40,6 +40,8 @@ #include "IECore/MessageHandler.h" #include "IECore/VectorTypedData.h" +#include "fmt/format.h" + using namespace IECoreGL; using namespace IECore; using namespace Imath; @@ -162,7 +164,7 @@ void ColorTexture::construct( unsigned int width, unsigned int height, const IEC castConstruct( width, height, r, g, b, a, mipMap ); } else { - throw IECore::Exception( boost::str( boost::format( "Unsupported channel type \"%s\"." ) % r->typeName() ) ); + throw IECore::Exception( fmt::format( "Unsupported channel type \"{}\".", r->typeName() ) ); } } diff --git a/src/IECoreGL/Debug.cpp b/src/IECoreGL/Debug.cpp index 51fdfc4ac0..2bc2cb2777 100644 --- a/src/IECoreGL/Debug.cpp +++ b/src/IECoreGL/Debug.cpp @@ -38,7 +38,7 @@ #include "IECore/MessageHandler.h" -#include "boost/format.hpp" +#include "fmt/format.h" namespace IECoreGL { @@ -62,7 +62,7 @@ void debugPrintErrors( const char *file, int line ) } while( error!=GL_NO_ERROR ); if( errors.size() ) { - std::string context = boost::str( boost::format( "%s line %d" ) % file % line ); + std::string context = fmt::format( "{} line {}", file, line ); IECore::msg( IECore::Msg::Error, context, errors ); } diff --git a/src/IECoreGL/DiskPrimitive.cpp b/src/IECoreGL/DiskPrimitive.cpp index 5aa929a009..004142cec0 100644 --- a/src/IECoreGL/DiskPrimitive.cpp +++ b/src/IECoreGL/DiskPrimitive.cpp @@ -96,7 +96,7 @@ void DiskPrimitive::addPrimitiveVariable( const std::string &name, const IECoreS addUniformAttribute( name, primVar.data ); break; default : - IECore::msg( IECore::Msg::Warning, "DiskPrimitive::addPrimitiveVariable", boost::format( "Primitive variable \"%s\" has unsupported interpolation." ) % name ); + IECore::msg( IECore::Msg::Warning, "DiskPrimitive::addPrimitiveVariable", "Primitive variable \"{}\" has unsupported interpolation.", name ); } } diff --git a/src/IECoreGL/Display.cpp b/src/IECoreGL/Display.cpp index 245369cb7a..afb8749d97 100644 --- a/src/IECoreGL/Display.cpp +++ b/src/IECoreGL/Display.cpp @@ -74,14 +74,14 @@ void Display::display( ConstFrameBufferPtr frameBuffer ) const } else { - IECore::msg( IECore::Msg::Warning, "Display::display", boost::format( "Unsupported data format \"%s\"." ) % m_data ); + IECore::msg( IECore::Msg::Warning, "Display::display", "Unsupported data format \"{}\".", m_data ); return; } IECore::WriterPtr writer = IECore::Writer::create( image, "tmp." + m_type ); if( !writer ) { - IECore::msg( IECore::Msg::Warning, "Display::display", boost::format( "Unsupported display type \"%s\"." ) % m_type ); + IECore::msg( IECore::Msg::Warning, "Display::display", "Unsupported display type \"{}\".", m_type ); return; } diff --git a/src/IECoreGL/FontLoader.cpp b/src/IECoreGL/FontLoader.cpp index 252938d80a..aee692c84b 100644 --- a/src/IECoreGL/FontLoader.cpp +++ b/src/IECoreGL/FontLoader.cpp @@ -58,7 +58,7 @@ FontPtr FontLoader::load( const std::string &name ) boost::filesystem::path path = m_searchPaths.find( name ); if( path.empty() ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::FontLoader::load", boost::format( "Couldn't find \"%s\"." ) % name ); + IECore::msg( IECore::Msg::Error, "IECoreGL::FontLoader::load", "Couldn't find \"{}\".", name ); m_fonts[name] = nullptr; // to save us trying over and over again return nullptr; } @@ -70,7 +70,7 @@ FontPtr FontLoader::load( const std::string &name ) } catch( const std::exception &e ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::Font::load", boost::format( "Failed to load \"%s\" ( %s )." ) % path.string() % e.what() ); + IECore::msg( IECore::Msg::Error, "IECoreGL::Font::load", "Failed to load \"{}\" ({}).", path.string(), e.what() ); m_fonts[name] = nullptr; // to save us trying over and over again return nullptr; } diff --git a/src/IECoreGL/HitRecord.cpp b/src/IECoreGL/HitRecord.cpp index 5d62e7392b..b4540c2acd 100644 --- a/src/IECoreGL/HitRecord.cpp +++ b/src/IECoreGL/HitRecord.cpp @@ -38,7 +38,7 @@ #include "IECore/Exception.h" -#include "boost/format.hpp" +#include "fmt/format.h" using namespace IECoreGL; @@ -50,7 +50,7 @@ HitRecord::HitRecord( const GLuint *hitRecord ) { if( hitRecord[0] != 1 ) { - throw IECore::Exception( ( boost::format( "HitRecord supports only one name - found %s.") % hitRecord[0] ).str() ); + throw IECore::Exception( fmt::format( "HitRecord supports only one name - found {}.", hitRecord[0] ) ); } } diff --git a/src/IECoreGL/IECoreGL.cpp b/src/IECoreGL/IECoreGL.cpp index d026eb6eb6..69e0e9bfd1 100644 --- a/src/IECoreGL/IECoreGL.cpp +++ b/src/IECoreGL/IECoreGL.cpp @@ -68,9 +68,7 @@ static int g_glslVersion = 0; IECore::msg( \ IECore::Msg::Error, \ "IECoreGL::init", \ - boost::format( \ - "Failed to get \"%s\" procedure." \ - ) % #funcName \ + "Failed to get \"{}\" procedure.", #funcName \ ); \ return; \ } \ @@ -267,9 +265,9 @@ void IECoreGL::init( bool glAlreadyInitialised ) return; } - INIT_ENTRY_POINT( wglCreatePbufferARB, PFNWGLCREATEPBUFFERARBPROC ); + INIT_ENTRY_POINT( wglCreatePbufferARB, PFNWGLCREATEPBUFFERARBPROC ); INIT_ENTRY_POINT( wglGetPbufferDCARB, PFNWGLGETPBUFFERDCARBPROC ); - INIT_ENTRY_POINT( wglChoosePixelFormatARB, PFNWGLCHOOSEPIXELFORMATARBPROC ); + INIT_ENTRY_POINT( wglChoosePixelFormatARB, PFNWGLCHOOSEPIXELFORMATARBPROC ); int pbufferIntAttribs[] = { WGL_DRAW_TO_PBUFFER_ARB, true, @@ -337,7 +335,7 @@ void IECoreGL::init( bool glAlreadyInitialised ) const GLenum initStatus = glewInit(); if( initStatus!=GLEW_OK ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::init", boost::format( "GLEW initialisation failed (%s)." ) % glewGetErrorString( initStatus ) ); + IECore::msg( IECore::Msg::Error, "IECoreGL::init", "GLEW initialisation failed ({}).", *glewGetErrorString( initStatus ) ); } init = true; diff --git a/src/IECoreGL/NameStateComponent.cpp b/src/IECoreGL/NameStateComponent.cpp index d603d8f0c9..fd923a493e 100644 --- a/src/IECoreGL/NameStateComponent.cpp +++ b/src/IECoreGL/NameStateComponent.cpp @@ -38,7 +38,7 @@ #include "IECore/Exception.h" -#include "boost/format.hpp" +#include "fmt/format.h" using namespace IECoreGL; @@ -82,9 +82,8 @@ const std::string &NameStateComponent::nameFromGLName( GLuint glName ) NameMap::nth_index<1>::type::const_iterator it = index.find( glName ); if( it==index.end() ) { - throw IECore::InvalidArgumentException( boost::str( - boost::format( "NameStateComponent::nameFromGLName : Invalid glName (%1%)" ) % glName - ) + throw IECore::InvalidArgumentException( + fmt::format( "NameStateComponent::nameFromGLName : Invalid glName ({})", glName ) ); } return it->first.value(); @@ -113,9 +112,8 @@ NameStateComponent::ConstNameIterator NameStateComponent::iteratorFromName( cons } else { - throw IECore::InvalidArgumentException( boost::str( - boost::format( "NameStateComponent::iteratorFromName : Invalid name (%1%)" ) % name - ) + throw IECore::InvalidArgumentException( + fmt::format( "NameStateComponent::iteratorFromName : Invalid name ({})", name ) ); } } diff --git a/src/IECoreGL/Primitive.cpp b/src/IECoreGL/Primitive.cpp index 9bfee89c61..f2c9d33097 100644 --- a/src/IECoreGL/Primitive.cpp +++ b/src/IECoreGL/Primitive.cpp @@ -51,8 +51,6 @@ #include "IECore/TypeTraits.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - using namespace IECoreGL; using namespace std; using namespace boost; diff --git a/src/IECoreGL/Shader.cpp b/src/IECoreGL/Shader.cpp index 32206d85f7..880a485449 100644 --- a/src/IECoreGL/Shader.cpp +++ b/src/IECoreGL/Shader.cpp @@ -49,7 +49,6 @@ #include "boost/algorithm/string/predicate.hpp" #include "boost/container/flat_map.hpp" -#include "boost/format.hpp" #include "boost/tokenizer.hpp" #include @@ -775,7 +774,7 @@ void Shader::Setup::addUniformParameter( const std::string &name, IECore::ConstD } if( !integers.size() ) { - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", format( "Uniform parameter \"%s\" has unsuitable data type \"%s\"" ) % name % value->typeName() ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", "Uniform parameter \"{}\" has unsuitable data type \"{}\"", name, value->typeName() ); } else { @@ -804,7 +803,7 @@ void Shader::Setup::addUniformParameter( const std::string &name, IECore::ConstD IECore::despatchTypedData< UniformDataConverter >, IECore::TypeTraits::IsNumericBasedTypedData, DespatchTypedDataIgnoreError>( const_cast( value.get() ), converter ); if( !floats.size() ) { - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", format( "Uniform parameter \"%s\" has unsuitable data type \"%s\"" ) % name % value->typeName() ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", "Uniform parameter \"{}\" has unsuitable data type \"{}\"", name, value->typeName() ); return; } else @@ -853,7 +852,7 @@ void Shader::Setup::addUniformParameter( const std::string &name, IECore::ConstD IECore::despatchTypedData< UniformDataConverter >, IECore::TypeTraits::IsNumericBasedTypedData, DespatchTypedDataIgnoreError>( const_cast( value.get() ), converter ); if( int( floats.size() ) != dimensions0 * dimensions1 * p->size ) { - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", format( "Matrix parameter \"%s\" requires %d values but value of type \"%s\" provided %d" ) % name % (dimensions0 * dimensions1) % value->typeName() % floats.size() ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", "Matrix parameter \"{}\" requires {} values but value of type \"{}\" provided {}", name, (dimensions0 * dimensions1), value->typeName(), floats.size() ); return; } @@ -861,7 +860,7 @@ void Shader::Setup::addUniformParameter( const std::string &name, IECore::ConstD } else { - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", format( "Uniform parameter \"%s\" has unsupported OpenGL type \"%d\"" ) % name % p->type ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addUniformParameter", "Uniform parameter \"{}\" has unsupported OpenGL type \"{}\"", name, p->type ); } } @@ -875,13 +874,13 @@ void Shader::Setup::addVertexAttribute( const std::string &name, IECore::ConstDa if( p->size > 1 ) { - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addVertexAttribute", format( "Array attribute \"%s\" is currently unsupported." ) % name ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addVertexAttribute", "Array attribute \"{}\" is currently unsupported.", name ); } GLenum dataGLType = glType( value.get() ); if( !dataGLType ) { - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addVertexAttribute", format( "Vertex attribute \"%s\" has unsuitable data type \"%s\"" ) % name % value->typeName() ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addVertexAttribute", "Vertex attribute \"{}\" has unsuitable data type \"{}\"", name, value->typeName() ); } GLint size = 0; @@ -903,7 +902,7 @@ void Shader::Setup::addVertexAttribute( const std::string &name, IECore::ConstDa size = 4; break; default : - IECore::msg( IECore::Msg::Warning, "Shader::Setup::addVertexAttribute", format( "Vertex attribute \"%s\" has unsupported OpenGL type \"%d\"" ) % name % p->type ); + IECore::msg( IECore::Msg::Warning, "Shader::Setup::addVertexAttribute", "Vertex attribute \"{}\" has unsupported OpenGL type \"{}\"", name, p->type ); return; } diff --git a/src/IECoreGL/ShaderLoader.cpp b/src/IECoreGL/ShaderLoader.cpp index e9819ca9ff..a2ff596e3a 100644 --- a/src/IECoreGL/ShaderLoader.cpp +++ b/src/IECoreGL/ShaderLoader.cpp @@ -38,7 +38,6 @@ #include "IECore/MessageHandler.h" -#include "boost/format.hpp" #include "boost/wave.hpp" #include "boost/wave/cpplexer/cpp_lex_iterator.hpp" #include "boost/wave/cpplexer/cpp_lex_token.hpp" @@ -46,6 +45,8 @@ #include #include +#include "fmt/format.h" + using namespace IECoreGL; using namespace IECore; using namespace boost::filesystem; @@ -126,7 +127,7 @@ class ShaderLoader::Implementation : public IECore::RefCounted path fragmentPath = m_searchPaths.find( name + ".frag" ); if( vertexPath.empty() && geometryPath.empty() && fragmentPath.empty() ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::ShaderLoader::loadSource", boost::format( "Couldn't find \"%s\"." ) % name ); + IECore::msg( IECore::Msg::Error, "IECoreGL::ShaderLoader::loadSource", "Couldn't find \"{}\".", name ); } if( !vertexPath.empty() ) @@ -288,7 +289,7 @@ class ShaderLoader::Implementation : public IECore::RefCounted catch( boost::wave::cpp_exception &e ) { // rethrow but in a nicely formatted form - throw IECore::Exception( boost::str( boost::format( "Error during preprocessing : %s line %d : %s" ) % fileName % e.line_no() % e.description() ) ); + throw IECore::Exception( fmt::format( "Error during preprocessing : {} line {} : {}", fileName, e.line_no(), e.description() ) ); } } return result; diff --git a/src/IECoreGL/SpherePrimitive.cpp b/src/IECoreGL/SpherePrimitive.cpp index 19baa1fc57..be3982b17b 100644 --- a/src/IECoreGL/SpherePrimitive.cpp +++ b/src/IECoreGL/SpherePrimitive.cpp @@ -129,7 +129,7 @@ void SpherePrimitive::addPrimitiveVariable( const std::string &name, const IECor addUniformAttribute( name, primVar.data ); break; default : - IECore::msg( IECore::Msg::Warning, "SpherePrimitive::addPrimitiveVariable", boost::format( "Primitive variable \"%s\" has unsupported interpolation." ) % name ); + IECore::msg( IECore::Msg::Warning, "SpherePrimitive::addPrimitiveVariable", "Primitive variable \"{}\" has unsupported interpolation.", name ); } } diff --git a/src/IECoreGL/SplineToGLTextureConverter.cpp b/src/IECoreGL/SplineToGLTextureConverter.cpp index 21a618b4c7..7685817350 100644 --- a/src/IECoreGL/SplineToGLTextureConverter.cpp +++ b/src/IECoreGL/SplineToGLTextureConverter.cpp @@ -41,8 +41,6 @@ #include "IECore/MessageHandler.h" -#include "boost/format.hpp" - #include using namespace IECoreGL; diff --git a/src/IECoreGL/Texture.cpp b/src/IECoreGL/Texture.cpp index 7dfca73a73..b9fa2cfbd1 100644 --- a/src/IECoreGL/Texture.cpp +++ b/src/IECoreGL/Texture.cpp @@ -34,8 +34,6 @@ #include "IECoreGL/Texture.h" -#include "boost/format.hpp" - using namespace IECoreGL; using namespace IECore; using namespace boost; diff --git a/src/IECoreGL/TextureLoader.cpp b/src/IECoreGL/TextureLoader.cpp index 2f6ed800c4..df719176b9 100644 --- a/src/IECoreGL/TextureLoader.cpp +++ b/src/IECoreGL/TextureLoader.cpp @@ -84,7 +84,7 @@ TexturePtr TextureLoader::load( const std::string &name, int maximumResolution ) boost::filesystem::path path = m_searchPaths.find( name ); if( path.empty() ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", boost::format( "Couldn't find \"%s\"." ) % name ); + IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", "Couldn't find \"{}\".", name ); m_loadedTextures[key] = nullptr; // to save us trying over and over again return nullptr; } @@ -107,7 +107,7 @@ TexturePtr TextureLoader::load( const std::string &name, int maximumResolution ) OIIO::ImageSpec mipSpec; if( !imageCache->get_imagespec( oiioPath, mipSpec, 0, 0 ) ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", boost::format( "Couldn't load \"%s\"." ) % path.string() ); + IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", "Couldn't load \"{}\".", path.string() ); m_loadedTextures[key] = nullptr; // to save us trying over and over again return nullptr; } @@ -139,7 +139,7 @@ TexturePtr TextureLoader::load( const std::string &name, int maximumResolution ) ); if( imageBuf.spec().full_x != 0 || imageBuf.spec().full_y != 0 ) { - IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", boost::format( "Texture display window must start at origin for \"%s\"." ) % path.string() ); + IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", "Texture display window must start at origin for \"{}\".", path.string() ); m_loadedTextures[key] = nullptr; // to save us trying over and over again return nullptr; } @@ -173,7 +173,7 @@ TexturePtr TextureLoader::load( const std::string &name, int maximumResolution ) if( !OIIO::ImageBufAlgo::colorconvert( imageBuf, imageBuf, currentColorSpace, linearColorSpace ) ) { // This conversion is the first operation that will trigger a lazy read of the ImageBuf - IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", boost::format( "Error reading \"%s\" : %s." ) % path.string() % imageBuf.geterror() ); + IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", "Error reading \"{}\" : {}.", path.string(), imageBuf.geterror() ); } @@ -207,8 +207,8 @@ TexturePtr TextureLoader::load( const std::string &name, int maximumResolution ) { IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", - boost::format( "Failed to read channel \"%s\" for \"%s\".%s" ) % - channelnames[chan] % path.string() % ( imageBuf.has_error() ? " " + imageBuf.geterror() : "" ) + "Failed to read channel \"{}\" for \"{}\".{}", + channelnames[chan], path.string(), ( imageBuf.has_error() ? " " + imageBuf.geterror() : "" ) ); } } @@ -224,7 +224,7 @@ TexturePtr TextureLoader::load( const std::string &name, int maximumResolution ) } else { - IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", boost::format( "Texture conversion failed for \"%s\" ( Invalid image format, ToGLTextureConverter supports RGB[A] and Y[A]. )." ) % path.string() ); + IECore::msg( IECore::Msg::Error, "IECoreGL::TextureLoader::load", "Texture conversion failed for \"{}\" ( Invalid image format, ToGLTextureConverter supports RGB[A] and Y[A]. ).", path.string() ); } m_loadedTextures[key] = t; return t; diff --git a/src/IECoreGL/ToGLCameraConverter.cpp b/src/IECoreGL/ToGLCameraConverter.cpp index 412bd500c0..7975cf827d 100644 --- a/src/IECoreGL/ToGLCameraConverter.cpp +++ b/src/IECoreGL/ToGLCameraConverter.cpp @@ -43,8 +43,6 @@ #include "IECore/ObjectParameter.h" #include "IECore/SimpleTypedData.h" -#include "boost/format.hpp" - using namespace IECoreGL; IE_CORE_DEFINERUNTIMETYPED( ToGLCameraConverter ); diff --git a/src/IECoreGL/ToGLCurvesConverter.cpp b/src/IECoreGL/ToGLCurvesConverter.cpp index e927fb1e99..43fb89fb21 100644 --- a/src/IECoreGL/ToGLCurvesConverter.cpp +++ b/src/IECoreGL/ToGLCurvesConverter.cpp @@ -131,7 +131,7 @@ IECore::RunTimeTypedPtr ToGLCurvesConverter::doConversion( IECore::ConstObjectPt { if( !pIt->second.data ) { - IECore::msg( IECore::Msg::Warning, "ToGLCurvesConverter", boost::format( "No data given for primvar \"%s\"" ) % pIt->first ); + IECore::msg( IECore::Msg::Warning, "ToGLCurvesConverter", "No data given for primvar \"{}\"", pIt->first ); continue; } diff --git a/src/IECoreGL/ToGLMeshConverter.cpp b/src/IECoreGL/ToGLMeshConverter.cpp index bb2eaf661a..2772c5a798 100644 --- a/src/IECoreGL/ToGLMeshConverter.cpp +++ b/src/IECoreGL/ToGLMeshConverter.cpp @@ -45,8 +45,6 @@ #include "IECore/MessageHandler.h" #include "IECore/SimpleTypedData.h" -#include "boost/format.hpp" - #include using namespace IECoreGL; @@ -105,7 +103,7 @@ IECore::RunTimeTypedPtr ToGLMeshConverter::doConversion( IECore::ConstObjectPtr } else { - IECore::msg( IECore::Msg::Warning, "ToGLMeshConverter", boost::format( "No data given for primvar \"%s\"" ) % pIt->first ); + IECore::msg( IECore::Msg::Warning, "ToGLMeshConverter", "No data given for primvar \"{}\"", pIt->first ); } } diff --git a/src/IECoreGL/ToGLPointsConverter.cpp b/src/IECoreGL/ToGLPointsConverter.cpp index 3f359458fa..240e7778d4 100644 --- a/src/IECoreGL/ToGLPointsConverter.cpp +++ b/src/IECoreGL/ToGLPointsConverter.cpp @@ -95,7 +95,7 @@ IECore::RunTimeTypedPtr ToGLPointsConverter::doConversion( IECore::ConstObjectPt } else { - IECore::msg( IECore::Msg::Warning, "ToGLPointsConverter::doConversion", boost::format( "Unknown type \"%s\" - reverting to particle type." ) % t->readable() ); + IECore::msg( IECore::Msg::Warning, "ToGLPointsConverter::doConversion", "Unknown type \"{}\" - reverting to particle type.", t->readable() ); } } @@ -114,7 +114,7 @@ IECore::RunTimeTypedPtr ToGLPointsConverter::doConversion( IECore::ConstObjectPt } else { - IECore::msg( IECore::Msg::Warning, "ToGLPointsConverter", boost::format( "No data given for primvar \"%s\"" ) % pIt->first ); + IECore::msg( IECore::Msg::Warning, "ToGLPointsConverter", "No data given for primvar \"{}\"", pIt->first ); } } diff --git a/src/IECoreGL/ToGLSphereConverter.cpp b/src/IECoreGL/ToGLSphereConverter.cpp index 7155a95eda..63b098e525 100644 --- a/src/IECoreGL/ToGLSphereConverter.cpp +++ b/src/IECoreGL/ToGLSphereConverter.cpp @@ -69,7 +69,7 @@ IECore::RunTimeTypedPtr ToGLSphereConverter::doConversion( IECore::ConstObjectPt } else { - IECore::msg( IECore::Msg::Warning, "ToGLSphereConverter", boost::format( "No data given for primvar \"%s\"" ) % it->first ); + IECore::msg( IECore::Msg::Warning, "ToGLSphereConverter", "No data given for primvar \"{}\"", it->first ); } } diff --git a/src/IECoreGL/ToGLStateConverter.cpp b/src/IECoreGL/ToGLStateConverter.cpp index 6d280da1b7..540801690f 100644 --- a/src/IECoreGL/ToGLStateConverter.cpp +++ b/src/IECoreGL/ToGLStateConverter.cpp @@ -50,6 +50,8 @@ #include "IECore/ObjectVector.h" #include "IECore/SimpleTypedData.h" +#include "fmt/format.h" + using namespace IECore; using namespace IECoreGL; @@ -67,7 +69,7 @@ StateComponentPtr attributeToTypedState( const IECore::Object *attribute ) const DataType *d = runTimeCast( attribute ); if( !d ) { - throw IECore::Exception( boost::str( boost::format( "Expected data of type \"%s\"" ) % DataType::staticTypeName() ) ); + throw IECore::Exception( fmt::format( "Expected data of type \"{}\"", DataType::staticTypeName() ) ); } return new T( d->readable() ); @@ -97,7 +99,7 @@ StateComponentPtr attributeToUseGLPointsState( const IECore::Object *attribute ) } else { - throw IECore::Exception( boost::str( boost::format( "Unsupported value \"%s\"." ) % v ) ); + throw IECore::Exception( fmt::format( "Unsupported value \"{}\".", v ) ); } return new PointsPrimitive::UseGLPoints( u ); diff --git a/src/IECoreGL/ToGLTextureConverter.cpp b/src/IECoreGL/ToGLTextureConverter.cpp index b0bbb80bfd..eb870dc037 100644 --- a/src/IECoreGL/ToGLTextureConverter.cpp +++ b/src/IECoreGL/ToGLTextureConverter.cpp @@ -47,8 +47,6 @@ #include "IECore/TypedData.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" - #include using namespace IECoreGL; From 8164b87ac718f890e0da5e1fa4966bf31a25257c Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:57:23 -0800 Subject: [PATCH 09/10] IECorePython : Prefer fmt::format --- src/IECorePython/FileSequenceBinding.cpp | 2 -- src/IECorePython/FileSequenceFunctionsBinding.cpp | 1 - src/IECorePython/FrameRangeBinding.cpp | 4 ++-- src/IECorePython/ImfTimeCodeBinding.cpp | 4 ++-- src/IECorePython/LRUCacheBinding.cpp | 8 +++----- src/IECorePython/MurmurHashBinding.cpp | 9 +++++---- src/IECorePython/PathMatcherBinding.cpp | 9 +++++---- 7 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/IECorePython/FileSequenceBinding.cpp b/src/IECorePython/FileSequenceBinding.cpp index 485e1073e2..4706d28f7b 100644 --- a/src/IECorePython/FileSequenceBinding.cpp +++ b/src/IECorePython/FileSequenceBinding.cpp @@ -42,8 +42,6 @@ #include "IECore/Exception.h" #include "IECore/FileSequence.h" -#include "boost/format.hpp" - using namespace boost::python; using namespace IECore; diff --git a/src/IECorePython/FileSequenceFunctionsBinding.cpp b/src/IECorePython/FileSequenceFunctionsBinding.cpp index e9a11a02da..14cdc36e46 100644 --- a/src/IECorePython/FileSequenceFunctionsBinding.cpp +++ b/src/IECorePython/FileSequenceFunctionsBinding.cpp @@ -44,7 +44,6 @@ #include "boost/filesystem/operations.hpp" #include "boost/filesystem/path.hpp" -#include "boost/format.hpp" using namespace boost::python; using namespace IECore; diff --git a/src/IECorePython/FrameRangeBinding.cpp b/src/IECorePython/FrameRangeBinding.cpp index dcd39ef646..e1e23d79d8 100644 --- a/src/IECorePython/FrameRangeBinding.cpp +++ b/src/IECorePython/FrameRangeBinding.cpp @@ -43,7 +43,7 @@ #include "IECore/Exception.h" #include "IECore/FrameRange.h" -#include "boost/format.hpp" +#include "fmt/format.h" using namespace boost::python; using namespace IECore; @@ -54,7 +54,7 @@ namespace IECorePython template<> std::string repr( FrameRange &x ) { - return ( boost::format("IECore.FrameRange( %d, %d, %d )" ) % x.getStart() % x.getEnd() % x.getStep() ).str(); + return fmt::format("IECore.FrameRange( {}, {}, {} )", x.getStart(), x.getEnd(), x.getStep() ); } void bindFrameRange() diff --git a/src/IECorePython/ImfTimeCodeBinding.cpp b/src/IECorePython/ImfTimeCodeBinding.cpp index 8372a108f1..9a6f9a4d2d 100644 --- a/src/IECorePython/ImfTimeCodeBinding.cpp +++ b/src/IECorePython/ImfTimeCodeBinding.cpp @@ -44,7 +44,7 @@ IECORE_PUSH_DEFAULT_VISIBILITY #include "OpenEXR/ImfTimeCode.h" IECORE_POP_DEFAULT_VISIBILITY -#include "boost/format.hpp" +#include "fmt/format.h" #include #include @@ -85,7 +85,7 @@ template<> std::string str( Imf::TimeCode &x ) { - return ( boost::format( "%02d:%02d:%02d:%02d" ) % x.hours() % x.minutes() % x.seconds() % x.frame() ).str(); + return fmt::format( "{:02}:{:02}:{:02}:{:02}", x.hours(), x.minutes(), x.seconds(), x.frame() ); } bool equal( Imf::TimeCode &x, Imf::TimeCode &y ) diff --git a/src/IECorePython/LRUCacheBinding.cpp b/src/IECorePython/LRUCacheBinding.cpp index befef27559..7e4569bfef 100644 --- a/src/IECorePython/LRUCacheBinding.cpp +++ b/src/IECorePython/LRUCacheBinding.cpp @@ -43,10 +43,10 @@ #include "IECore/LRUCache.h" -#include "boost/format.hpp" - #include "tbb/parallel_for.h" +#include "fmt/format.h" + #include using namespace boost::python; @@ -178,9 +178,7 @@ struct GetFromTestCache if( k != v ) { throw Exception( - boost::str( - boost::format( "Incorrect LRUCache value found (expected %d but got %d)" ) % k %v - ) + fmt::format( "Incorrect LRUCache value found (expected {} but got {})", k, v ) ); } diff --git a/src/IECorePython/MurmurHashBinding.cpp b/src/IECorePython/MurmurHashBinding.cpp index 649317be44..f5b73c96e7 100644 --- a/src/IECorePython/MurmurHashBinding.cpp +++ b/src/IECorePython/MurmurHashBinding.cpp @@ -32,7 +32,6 @@ // ////////////////////////////////////////////////////////////////////////// -#include "boost/format.hpp" #include "boost/python.hpp" #include "IECorePython/MurmurHashBinding.h" @@ -41,6 +40,8 @@ #include "IECore/MurmurHash.h" #include "IECore/VectorTypedData.h" +#include "fmt/format.h" + using namespace boost::python; using namespace IECore; @@ -80,9 +81,9 @@ static long hash( MurmurHash *h ) #define IECORETEST_ASSERT( x ) \ if( !( x ) ) \ { \ - throw IECore::Exception( boost::str( \ - boost::format( "Failed assertion \"%s\" : %s line %d" ) % #x % __FILE__ % __LINE__ \ - ) ); \ + throw IECore::Exception( \ + fmt::format( "Failed assertion \"{}\" : {} line {}", #x, __FILE__, __LINE__ ) \ + ); \ } struct HashDispatchFunctor diff --git a/src/IECorePython/PathMatcherBinding.cpp b/src/IECorePython/PathMatcherBinding.cpp index ecd055321d..129433d2cb 100644 --- a/src/IECorePython/PathMatcherBinding.cpp +++ b/src/IECorePython/PathMatcherBinding.cpp @@ -45,10 +45,11 @@ #include "IECore/PathMatcherData.h" #include "IECore/VectorTypedData.h" -#include "boost/format.hpp" #include "boost/python/suite/indexing/container_utils.hpp" #include "boost/tokenizer.hpp" +#include "fmt/format.h" + using namespace std; using namespace boost::python; using namespace IECore; @@ -59,9 +60,9 @@ namespace #define IECORETEST_ASSERT( x ) \ if( !( x ) ) \ { \ - throw IECore::Exception( boost::str( \ - boost::format( "Failed assertion \"%s\" : %s line %d" ) % #x % __FILE__ % __LINE__ \ - ) ); \ + throw IECore::Exception( \ + fmt::format( "Failed assertion \"{}\" : {} line {}", #x, __FILE__, __LINE__ ) \ + ); \ } void testPathMatcherRawIterator() From 33b936e945545f79e84fe64ffbedcc93a3ef6caa Mon Sep 17 00:00:00 2001 From: Murray Stevenson <50844517+murraystevenson@users.noreply.github.com> Date: Thu, 12 Feb 2026 15:57:33 -0800 Subject: [PATCH 10/10] IECoreVDB : Prefer fmt::format --- src/IECoreVDB/VDBObject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IECoreVDB/VDBObject.cpp b/src/IECoreVDB/VDBObject.cpp index 3a3d35c1c0..ad49dd8a9b 100644 --- a/src/IECoreVDB/VDBObject.cpp +++ b/src/IECoreVDB/VDBObject.cpp @@ -285,7 +285,7 @@ IECore::CompoundObjectPtr VDBObject::metadata( const std::string &name ) IECore::msg( IECore::MessageHandler::Warning, "VDBObject::metadata", - boost::format( "'%1%' has unsupported metadata type: '%2%'" ) % metaIt->first % metaIt->second->typeName() + "'{}' has unsupported metadata type: '{}'", metaIt->first, metaIt->second->typeName() ); } }