Replaced boost::format with internal formater

This commit is contained in:
mensinda
2016-04-06 00:03:05 +02:00
parent 5dacda0a08
commit b37e25cd7d
8 changed files with 67 additions and 61 deletions

View File

@@ -48,11 +48,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "SkeletonMeshBuilder.h"
#include "../include/assimp/Importer.hpp"
#include <memory>
#include <boost/format.hpp>
#include "TinyFormatter.h"
#include "../include/assimp/IOSystem.hpp"
#include "../include/assimp/scene.h"
using namespace Assimp;
using namespace Assimp::Formatter;
static const aiImporterDesc desc = {
"BVH Importer (MoCap)",
@@ -179,12 +180,12 @@ aiNode* BVHLoader::ReadNode()
// first token is name
std::string nodeName = GetNextToken();
if( nodeName.empty() || nodeName == "{")
ThrowException( boost::str( boost::format( "Expected node name, but found \"%s\".") % nodeName));
ThrowException( format() << "Expected node name, but found \"" << nodeName << "\"." );
// then an opening brace should follow
std::string openBrace = GetNextToken();
if( openBrace != "{")
ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace));
ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\"." );
// Create a node
aiNode* node = new aiNode( nodeName);
@@ -216,7 +217,7 @@ aiNode* BVHLoader::ReadNode()
// The real symbol is "End Site". Second part comes in a separate token
std::string siteToken = GetNextToken();
if( siteToken != "Site")
ThrowException( boost::str( boost::format( "Expected \"End Site\" keyword, but found \"%s %s\".") % token % siteToken));
ThrowException( format() << "Expected \"End Site\" keyword, but found \"" << token << " " << siteToken << "\"." );
aiNode* child = ReadEndSite( nodeName);
child->mParent = node;
@@ -229,7 +230,7 @@ aiNode* BVHLoader::ReadNode()
} else
{
// everything else is a parse error
ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token));
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
}
}
@@ -252,7 +253,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
// check opening brace
std::string openBrace = GetNextToken();
if( openBrace != "{")
ThrowException( boost::str( boost::format( "Expected opening brace \"{\", but found \"%s\".") % openBrace));
ThrowException( format() << "Expected opening brace \"{\", but found \"" << openBrace << "\".");
// Create a node
aiNode* node = new aiNode( "EndSite_" + pParentName);
@@ -274,7 +275,7 @@ aiNode* BVHLoader::ReadEndSite( const std::string& pParentName)
} else
{
// everything else is a parse error
ThrowException( boost::str( boost::format( "Unknown keyword \"%s\".") % token));
ThrowException( format() << "Unknown keyword \"" << token << "\"." );
}
}
@@ -321,7 +322,7 @@ void BVHLoader::ReadNodeChannels( BVHLoader::Node& pNode)
else if( channelToken == "Zrotation")
pNode.mChannels.push_back( Channel_RotationZ);
else
ThrowException( boost::str( boost::format( "Invalid channel specifier \"%s\".") % channelToken));
ThrowException( format() << "Invalid channel specifier \"" << channelToken << "\"." );
}
}
@@ -332,7 +333,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
// Read number of frames
std::string tokenFrames = GetNextToken();
if( tokenFrames != "Frames:")
ThrowException( boost::str( boost::format( "Expected frame count \"Frames:\", but found \"%s\".") % tokenFrames));
ThrowException( format() << "Expected frame count \"Frames:\", but found \"" << tokenFrames << "\".");
float numFramesFloat = GetNextTokenAsFloat();
mAnimNumFrames = (unsigned int) numFramesFloat;
@@ -341,7 +342,7 @@ void BVHLoader::ReadMotion( aiScene* /*pScene*/)
std::string tokenDuration1 = GetNextToken();
std::string tokenDuration2 = GetNextToken();
if( tokenDuration1 != "Frame" || tokenDuration2 != "Time:")
ThrowException( boost::str( boost::format( "Expected frame duration \"Frame Time:\", but found \"%s %s\".") % tokenDuration1 % tokenDuration2));
ThrowException( format() << "Expected frame duration \"Frame Time:\", but found \"" << tokenDuration1 << " " << tokenDuration2 << "\"." );
mAnimTickDuration = GetNextTokenAsFloat();
@@ -414,7 +415,7 @@ float BVHLoader::GetNextTokenAsFloat()
ctoken = fast_atoreal_move<float>( ctoken, result);
if( ctoken != token.c_str() + token.length())
ThrowException( boost::str( boost::format( "Expected a floating point number, but found \"%s\".") % token));
ThrowException( format() << "Expected a floating point number, but found \"" << token << "\"." );
return result;
}
@@ -423,7 +424,7 @@ float BVHLoader::GetNextTokenAsFloat()
// Aborts the file reading with an exception
AI_WONT_RETURN void BVHLoader::ThrowException( const std::string& pError)
{
throw DeadlyImportError( boost::str( boost::format( "%s:%d - %s") % mFileName % mLine % pError));
throw DeadlyImportError( format() << mFileName << ":" << mLine << " - " << pError);
}
// ------------------------------------------------------------------------------------------------