3737#include " IECore/Exception.h"
3838
3939#include " boost/algorithm/string.hpp"
40- #include " boost/format.hpp"
4140#include " boost/lexical_cast.hpp"
4241#include " boost/regex.hpp"
4342
@@ -198,7 +197,9 @@ void FileSequence::setSuffix( const std::string &suffix )
198197
199198std::string FileSequence::fileNameForFrame ( FrameList::Frame frameNumber ) const
200199{
201- return ( fileNameTemplate ( frameNumber < 0 ) % frameNumber ).str ();
200+ return fmt::format (
201+ " {0}{1:0{2}}{3}" , getPrefix (), frameNumber, getPadding () + ( frameNumber < 0 ? 1 : 0 ), getSuffix ()
202+ );
202203}
203204
204205FrameList::Frame FileSequence::frameForFileName ( const std::string &fileName ) const
@@ -225,41 +226,29 @@ void FileSequence::fileNames( std::vector< std::string > &f ) const
225226{
226227 f.clear ();
227228
228- boost::format posFmt = fileNameTemplate ( false );
229- boost::format negFmt = fileNameTemplate ( true );
230-
231229 std::vector< FrameList::Frame > frames;
232-
233230 m_frameList->asList ( frames );
234231
235- for ( std::vector< FrameList::Frame >::const_iterator it = frames. begin (); it != frames. end (); ++it )
232+ for ( auto frame : frames )
236233 {
237- boost::format &fmt = *it < 0 ? negFmt : posFmt ;
238- f.push_back ( ( fmt % *it ).str () );
234+ f.push_back ( fileNameForFrame ( frame ) );
239235 }
240236}
241237
242238void FileSequence::clumpedFileNames ( unsigned clumpSize, std::vector< std::vector < std::string > > &f ) const
243239{
244240 f.clear ();
245241
246- boost::format posFmt = fileNameTemplate ( false );
247- boost::format negFmt = fileNameTemplate ( true );
248-
249242 std::vector< std::vector< FrameList::Frame > > clumpedFrames;
250243
251244 m_frameList->asClumpedList ( clumpedFrames, clumpSize );
252245
253- for ( std::vector< std::vector< FrameList::Frame > >::const_iterator it = clumpedFrames. begin (); it != clumpedFrames. end (); ++it )
246+ for ( const auto &clump : clumpedFrames )
254247 {
255- const std::vector< FrameList::Frame > &clump = *it;
256-
257248 f.push_back ( std::vector< std::string >() );
258-
259- for ( std::vector< FrameList::Frame > ::const_iterator cit = clump.begin (); cit != clump.end (); ++cit )
249+ for ( auto frame : clump )
260250 {
261- boost::format &fmt = *cit < 0 ? negFmt : posFmt ;
262- f.back ().push_back ( ( fmt % *cit ).str () );
251+ f.back ().push_back ( fileNameForFrame ( frame ) );
263252 }
264253 }
265254}
@@ -325,19 +314,3 @@ bool FileSequence::operator ==( const FileSequence &other ) const
325314{
326315 return m_fileName == other.m_fileName && m_frameList->isEqualTo ( other.m_frameList );
327316}
328-
329- boost::format FileSequence::fileNameTemplate ( bool negativeFrame ) const
330- {
331- unsigned padding = getPadding ();
332- std::string paddingStr = " " ;
333- for ( unsigned i = 0 ; i < padding; i++)
334- {
335- paddingStr += " #" ;
336- }
337-
338- std::string f = m_fileName;
339- boost::replace_all ( f, " %" , " %%" );
340- boost::replace_all ( f, paddingStr, ( boost::format ( " %%0%dd" ) % ( negativeFrame ? padding + 1 : padding ) ).str () );
341-
342- return boost::format ( f );
343- }
0 commit comments