diff --git a/Changes b/Changes index d95afdf26f..34f3daa413 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,11 @@ API - MessageHandler : Added `msg()` overload that accepts a `fmt::format_string` and arguments. - InternedString : Added specialisation for `fmt::formatter`. +Breaking Changes +---------------- + +- MessageHandler : Removed support for passing `boost::format` objects to `msg()`. Use `fmt::format()` instead. + Build ----- diff --git a/include/IECore/MessageHandler.h b/include/IECore/MessageHandler.h index ec4889066e..8030a3bdf8 100644 --- a/include/IECore/MessageHandler.h +++ b/include/IECore/MessageHandler.h @@ -38,7 +38,6 @@ #include "IECore/Export.h" #include "IECore/RefCounted.h" -#include "boost/format.hpp" #include "boost/noncopyable.hpp" #include "fmt/format.h" @@ -82,8 +81,6 @@ class IECORE_API MessageHandler : public RefCounted //@{ /// Output a message to the current handler. static void output( Level level, const std::string &context, const std::string &message ); - /// Output a message to the current handler. - static void output( Level level, const std::string &context, const boost::format &message ); //@} //! @name Default handler @@ -156,7 +153,6 @@ typedef MessageHandler Msg; /// Free functions which calls MessageHandler::output() with their arguments. These are provided /// 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 ) diff --git a/src/IECore/MessageHandler.cpp b/src/IECore/MessageHandler.cpp index 73f4e673e3..834fd04491 100644 --- a/src/IECore/MessageHandler.cpp +++ b/src/IECore/MessageHandler.cpp @@ -56,12 +56,6 @@ void MessageHandler::output( Level level, const std::string &context, const std: currentHandler()->handle( level, context, message ); } -void MessageHandler::output( Level level, const std::string &context, const boost::format &message ) -{ - string m = message.str(); - output( level, context, m ); -} - /////////////////////////////////////////////////////////////////////////////////////// // default handler /////////////////////////////////////////////////////////////////////////////////////// @@ -173,8 +167,3 @@ void IECore::msg( MessageHandler::Level level, const std::string &context, const { MessageHandler::output( level, context, message ); } - -void IECore::msg( MessageHandler::Level level, const std::string &context, const boost::format &message ) -{ - MessageHandler::output( level, context, message ); -} diff --git a/src/IECoreGL/Selector.cpp b/src/IECoreGL/Selector.cpp index 5a2ce33f2c..ecf8317ae9 100644 --- a/src/IECoreGL/Selector.cpp +++ b/src/IECoreGL/Selector.cpp @@ -306,7 +306,7 @@ class Selector::Implementation : public IECore::RefCounted ////////////////////////////////////////////////////////////////////////// FrameBufferPtr m_frameBuffer; - boost::shared_ptr m_frameBufferBinding; + std::unique_ptr m_frameBufferBinding; GLint m_prevProgram; ConstShaderPtr m_currentIDShader; std::stack m_IDShaderStack; @@ -325,7 +325,7 @@ class Selector::Implementation : public IECore::RefCounted } m_frameBuffer->setDepth( new DepthTexture( 128, 128 ) ); m_frameBuffer->validate(); - m_frameBufferBinding = boost::shared_ptr( new FrameBuffer::ScopedBinding( *m_frameBuffer ) ); + m_frameBufferBinding = std::make_unique( *m_frameBuffer ); glGetIntegerv( GL_VIEWPORT, m_prevViewport ); glViewport( 0, 0, 128, 128 ); diff --git a/src/IECoreImage/ImagePrimitive.cpp b/src/IECoreImage/ImagePrimitive.cpp index 3257766067..7ce334a006 100644 --- a/src/IECoreImage/ImagePrimitive.cpp +++ b/src/IECoreImage/ImagePrimitive.cpp @@ -41,6 +41,8 @@ #include "boost/static_assert.hpp" +#include "fmt/format.h" + #include using namespace std; @@ -406,7 +408,7 @@ bool ImagePrimitive::channelValid( const IECore::Data *data, std::string *reason { if( reason ) { - *reason = str( format( "Channel has wrong size (%d but should be %d)." ) % size % numPixels ); + *reason = fmt::format( "Channel has wrong size ({} but should be {}).", size, numPixels ); } return false; } @@ -421,7 +423,7 @@ bool ImagePrimitive::channelValid( const std::string &name, std::string *reason { if( reason ) { - *reason = str( format( "Channel \"%s\" does not exist." ) % name ); + *reason = fmt::format( "Channel \"{}\" does not exist.", name ); } return false; } diff --git a/src/IECoreScene/Font.cpp b/src/IECoreScene/Font.cpp index ce2241fc4a..df124742fe 100644 --- a/src/IECoreScene/Font.cpp +++ b/src/IECoreScene/Font.cpp @@ -476,9 +476,7 @@ class Font::Implementation : public IECore::RefCounted V2f advance; }; - typedef boost::shared_ptr MeshPtr; - typedef boost::shared_ptr ConstMeshPtr; - mutable std::vector m_meshes; + mutable std::vector> m_meshes; const Mesh *cachedMesh( char c ) const { @@ -511,11 +509,11 @@ class Font::Implementation : public IECore::RefCounted transformOp->operate(); // put it in the cache - MeshPtr mesh( new Mesh ); + auto &mesh = m_meshes[c]; + mesh = std::make_unique(); mesh->primitive = primitive; mesh->bound = primitive->bound(); mesh->advance = V2f( m_face->glyph->advance.x, m_face->glyph->advance.y ) / m_face->units_per_EM; - m_meshes[c] = mesh; // return it return mesh.get(); diff --git a/src/IECoreScene/PDCParticleReader.cpp b/src/IECoreScene/PDCParticleReader.cpp index 0057c5ef81..6942e77ce5 100644 --- a/src/IECoreScene/PDCParticleReader.cpp +++ b/src/IECoreScene/PDCParticleReader.cpp @@ -124,7 +124,7 @@ bool PDCParticleReader::open() if( m_header.version > 1 ) { - msg( Msg::Warning, "PDCParticleReader::open()", format( "File \"%s\" has unknown version %d." ) % fileName() % m_header.version ); + msg( Msg::Warning, "PDCParticleReader::open()", "File \"{}\" has unknown version {}.", fileName(), m_header.version ); } int unused = 0; @@ -262,7 +262,7 @@ DataPtr PDCParticleReader::readAttribute( const std::string &name ) const Data *idAttr = idAttribute(); if ( !idAttr && particlePercentage() < 100.0f ) { - msg( Msg::Warning, "PDCParticleReader::filterAttr", format( "Percentage filtering requested but file \"%s\" contains no particle Id attribute." ) % fileName() ); + msg( Msg::Warning, "PDCParticleReader::filterAttr", "Percentage filtering requested but file \"{}\" contains no particle Id attribute.", fileName() ); } DataPtr result = nullptr; diff --git a/src/IECoreScene/PDCParticleWriter.cpp b/src/IECoreScene/PDCParticleWriter.cpp index 073d9ecf5b..cf85853db3 100644 --- a/src/IECoreScene/PDCParticleWriter.cpp +++ b/src/IECoreScene/PDCParticleWriter.cpp @@ -152,7 +152,7 @@ void PDCParticleWriter::doWrite( const CompoundObject *operands ) } else { - msg( Msg::Warning, "PDCParticleWriter::write", format( "Attribute \"%s\" is of unsupported type \"%s\"." ) % *it % attr->typeName() ); + msg( Msg::Warning, "PDCParticleWriter::write", "Attribute \"{}\" is of unsupported type \"{}\".", *it, attr->typeName() ); } } diff --git a/src/IECoreScene/ParticleReader.cpp b/src/IECoreScene/ParticleReader.cpp index 4f78a76b21..ac061b0ac6 100644 --- a/src/IECoreScene/ParticleReader.cpp +++ b/src/IECoreScene/ParticleReader.cpp @@ -190,7 +190,7 @@ ObjectPtr ParticleReader::doOperation( const CompoundObject * operands ) } else { - msg( Msg::Warning, "ParticleReader::doOperation", format( "Ignoring attribute \"%s\" due to insufficient elements (expected %d but found %d)." ) % *it % result->getNumPoints() % s ); + msg( Msg::Warning, "ParticleReader::doOperation", "Ignoring attribute \"{}\" due to insufficient elements (expected {} but found {}).", *it, result->getNumPoints(), s ); } } else if ( testTypedData( d.get() ) ) diff --git a/src/IECoreScene/ParticleWriter.cpp b/src/IECoreScene/ParticleWriter.cpp index b7bd3ff572..0368514c15 100644 --- a/src/IECoreScene/ParticleWriter.cpp +++ b/src/IECoreScene/ParticleWriter.cpp @@ -95,7 +95,7 @@ void ParticleWriter::particleAttributes( std::vector &names ) } else { - msg( Msg::Warning, "ParticleWriter::particleAttributes", format( "Ignoring attribute \"%s\" due to insufficient elements (expected %d but found %d)." ) % it->first % numParticles % s ); + msg( Msg::Warning, "ParticleWriter::particleAttributes", "Ignoring attribute \"{}\" due to insufficient elements (expected {} but found {}).", it->first, numParticles, s ); } } else if ( testTypedData( it->second.data.get() ) ) @@ -124,7 +124,7 @@ void ParticleWriter::particleAttributes( std::vector &names ) } else { - msg( Msg::Warning, "ParticleWriter::particleAttributes", format( "Attribute \"%s\" requested via parameters but is not available." ) % *it ); + msg( Msg::Warning, "ParticleWriter::particleAttributes", "Attribute \"{}\" requested via parameters but is not available.", *it ); } } } diff --git a/src/IECoreScene/PointsAlgoSegment.cpp b/src/IECoreScene/PointsAlgoSegment.cpp index 39a9f20ad9..b1151d2ff4 100644 --- a/src/IECoreScene/PointsAlgoSegment.cpp +++ b/src/IECoreScene/PointsAlgoSegment.cpp @@ -39,8 +39,6 @@ #include "IECore/DespatchTypedData.h" #include "IECore/TypeTraits.h" -#include "boost/format.hpp" - using namespace IECore; using namespace IECoreScene; using namespace Imath;