From ae99f99b99537db483d9cac65c43bef272fe7f42 Mon Sep 17 00:00:00 2001 From: mensinda Date: Wed, 6 Apr 2016 00:17:21 +0200 Subject: [PATCH] Replaced boost::tuple with std::tuple --- code/ColladaExporter.cpp | 6 +++--- code/ColladaExporter.h | 3 +-- code/FBXConverter.cpp | 28 ++++++++++++++-------------- code/IFCBoolean.cpp | 30 +++++++++++++++--------------- code/IFCLoader.cpp | 2 +- code/XFileImporter.cpp | 1 - code/XFileParser.cpp | 3 +-- tools/assimp_view/AnimEvaluator.h | 4 ++-- 8 files changed, 37 insertions(+), 40 deletions(-) diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index e9fd0a0be..a2d419af2 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -636,7 +636,7 @@ void ColladaExporter::WriteMaterials() aiString name; if( mat->Get( AI_MATKEY_NAME, name) != aiReturn_SUCCESS ) name = "mat"; - materials[a].name = std::string( "m") + boost::lexical_cast (a) + name.C_Str(); + materials[a].name = std::string( "m") + std::to_string(a) + name.C_Str(); for( std::string::iterator it = materials[a].name.begin(); it != materials[a].name.end(); ++it ) { if( !isalnum_C( *it ) ) { *it = '_'; @@ -812,7 +812,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex) { if( mesh->HasTextureCoords( a) ) { - WriteFloatArray( idstr + "-tex" + boost::lexical_cast (a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2, + WriteFloatArray( idstr + "-tex" + std::to_string(a), mesh->mNumUVComponents[a] == 3 ? FloatType_TexCoord3 : FloatType_TexCoord2, (float*) mesh->mTextureCoords[a], mesh->mNumVertices); } } @@ -821,7 +821,7 @@ void ColladaExporter::WriteGeometry( size_t pIndex) for( size_t a = 0; a < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++a) { if( mesh->HasVertexColors( a) ) - WriteFloatArray( idstr + "-color" + boost::lexical_cast (a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices); + WriteFloatArray( idstr + "-color" + std::to_string(a), FloatType_Color, (float*) mesh->mColors[a], mesh->mNumVertices); } // assemble vertex structure diff --git a/code/ColladaExporter.h b/code/ColladaExporter.h index fcaf55ca6..52a160224 100644 --- a/code/ColladaExporter.h +++ b/code/ColladaExporter.h @@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#include struct aiScene; struct aiNode; @@ -123,7 +122,7 @@ protected: void PopTag() { ai_assert( startstr.length() > 1); startstr.erase( startstr.length() - 2); } /// Creates a mesh ID for the given mesh - std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + boost::lexical_cast (pIndex); } + std::string GetMeshId( size_t pIndex) const { return std::string( "meshId" ) + std::to_string(pIndex); } public: /// Stringstream to write all output into diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index 577fc1d9d..cf2b8dbf2 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -54,7 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "StringComparison.h" #include "../include/assimp/scene.h" -#include +#include #include #include @@ -338,7 +338,7 @@ private: bool reverse_order = false ); // key (time), value, mapto (component index) - typedef boost::tuple, std::shared_ptr, unsigned int > KeyFrameList; + typedef std::tuple, std::shared_ptr, unsigned int > KeyFrameList; typedef std::vector KeyFrameListList; @@ -2966,7 +2966,7 @@ Converter::KeyFrameListList Converter::GetKeyframeList( const std::vector()->size() ); + estimate = std::max( estimate, std::get<0>(kfl)->size() ); } keys.reserve( estimate ); @@ -2999,8 +2999,8 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs ) for ( size_t i = 0; i < count; ++i ) { const KeyFrameList& kfl = inputs[ i ]; - if ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) < min_tick ) { - min_tick = kfl.get<0>()->at( next_pos[ i ] ); + if ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) < min_tick ) { + min_tick = std::get<0>(kfl)->at( next_pos[ i ] ); } } @@ -3013,7 +3013,7 @@ KeyTimeList Converter::GetKeyTimeList( const KeyFrameListList& inputs ) const KeyFrameList& kfl = inputs[ i ]; - while ( kfl.get<0>()->size() > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == min_tick ) { + while ( std::get<0>(kfl)->size() > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == min_tick ) { ++next_pos[ i ]; } } @@ -3042,8 +3042,8 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c for ( size_t i = 0; i < count; ++i ) { const KeyFrameList& kfl = inputs[ i ]; - const size_t ksize = kfl.get<0>()->size(); - if ( ksize > next_pos[ i ] && kfl.get<0>()->at( next_pos[ i ] ) == time ) { + const size_t ksize = std::get<0>(kfl)->size(); + if ( ksize > next_pos[ i ] && std::get<0>(kfl)->at( next_pos[ i ] ) == time ) { ++next_pos[ i ]; } @@ -3051,18 +3051,18 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c const size_t id1 = next_pos[ i ] == ksize ? ksize - 1 : next_pos[ i ]; // use lerp for interpolation - const KeyValueList::value_type valueA = kfl.get<1>()->at( id0 ); - const KeyValueList::value_type valueB = kfl.get<1>()->at( id1 ); + const KeyValueList::value_type valueA = std::get<1>(kfl)->at( id0 ); + const KeyValueList::value_type valueB = std::get<1>(kfl)->at( id1 ); - const KeyTimeList::value_type timeA = kfl.get<0>()->at( id0 ); - const KeyTimeList::value_type timeB = kfl.get<0>()->at( id1 ); + const KeyTimeList::value_type timeA = std::get<0>(kfl)->at( id0 ); + const KeyTimeList::value_type timeB = std::get<0>(kfl)->at( id1 ); // do the actual interpolation in double-precision arithmetics // because it is a bit sensitive to rounding errors. const double factor = timeB == timeA ? 0. : static_cast( ( time - timeA ) / ( timeB - timeA ) ); const float interpValue = static_cast( valueA + ( valueB - valueA ) * factor ); - result[ kfl.get<2>() ] = interpValue; + result[ std::get<2>(kfl) ] = interpValue; } // magic value to convert fbx times to seconds diff --git a/code/IFCBoolean.cpp b/code/IFCBoolean.cpp index 873cd6d45..042515311 100644 --- a/code/IFCBoolean.cpp +++ b/code/IFCBoolean.cpp @@ -50,7 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "Defines.h" #include -#include +#include namespace Assimp { @@ -510,7 +510,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded if( !blackside.empty() ) { // poly edge index, intersection point, edge index in boundary poly - std::vector > intersections; + std::vector > intersections; bool startedInside = PointInPoly(proj * blackside.front(), profile->verts); bool isCurrentlyInside = startedInside; @@ -542,7 +542,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded } // now add them to the list of intersections for( size_t b = 0; b < intersected_boundary.size(); ++b ) - intersections.push_back(boost::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first)); + intersections.push_back(std::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first)); // and calculate our new inside/outside state if( intersected_boundary.size() & 1 ) @@ -568,12 +568,12 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded // Filter pairs of out->in->out that lie too close to each other. for( size_t a = 0; intersections.size() > 0 && a < intersections.size() - 1; /**/ ) { - if( (intersections[a].get<1>() - intersections[(a + 1) % intersections.size()].get<1>()).SquareLength() < 1e-10 ) + if( (std::get<1>(intersections[a]) - std::get<1>(intersections[(a + 1) % intersections.size()])).SquareLength() < 1e-10 ) intersections.erase(intersections.begin() + a, intersections.begin() + a + 2); else a++; } - if( intersections.size() > 1 && (intersections.back().get<1>() - intersections.front().get<1>()).SquareLength() < 1e-10 ) + if( intersections.size() > 1 && (std::get<1>(intersections.back()) - std::get<1>(intersections.front())).SquareLength() < 1e-10 ) { intersections.pop_back(); intersections.erase(intersections.begin()); } @@ -619,23 +619,23 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded while( true ) { ai_assert(intersections.size() > currentIntersecIdx + 1); - boost::tuple currintsec = intersections[currentIntersecIdx + 0]; - boost::tuple nextintsec = intersections[currentIntersecIdx + 1]; + std::tuple currintsec = intersections[currentIntersecIdx + 0]; + std::tuple nextintsec = intersections[currentIntersecIdx + 1]; intersections.erase(intersections.begin() + currentIntersecIdx, intersections.begin() + currentIntersecIdx + 2); // we start with an in->out intersection - resultpoly.push_back(currintsec.get<1>()); + resultpoly.push_back(std::get<1>(currintsec)); // climb along the polygon to the next intersection, which should be an out->in - size_t numPolyPoints = (currintsec.get<0>() > nextintsec.get<0>() ? blackside.size() : 0) - + nextintsec.get<0>() - currintsec.get<0>(); + size_t numPolyPoints = (std::get<0>(currintsec) > std::get<0>(nextintsec) ? blackside.size() : 0) + + std::get<0>(nextintsec) - std::get<0>(currintsec); for( size_t a = 1; a <= numPolyPoints; ++a ) - resultpoly.push_back(blackside[(currintsec.get<0>() + a) % blackside.size()]); + resultpoly.push_back(blackside[(std::get<0>(currintsec) + a) % blackside.size()]); // put the out->in intersection - resultpoly.push_back(nextintsec.get<1>()); + resultpoly.push_back(std::get<1>(nextintsec)); // generate segments along the boundary polygon that lie in the poly's plane until we hit another intersection - IfcVector3 startingPoint = proj * nextintsec.get<1>(); - size_t currentBoundaryEdgeIdx = (nextintsec.get<2>() + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size(); + IfcVector3 startingPoint = proj * std::get<1>(nextintsec); + size_t currentBoundaryEdgeIdx = (std::get<2>(nextintsec) + (marchBackwardsOnBoundary ? 1 : 0)) % profile->verts.size(); size_t nextIntsecIdx = SIZE_MAX; while( nextIntsecIdx == SIZE_MAX ) { @@ -676,7 +676,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded // to marching along the poly border from that intersection point for( size_t a = 0; a < intersections.size(); a += 2 ) { - dirToThatPoint = proj * intersections[a].get<1>() - startingPoint; + dirToThatPoint = proj * std::get<1>(intersections[a]) - startingPoint; tpt = dirToThatPoint * dirAtPolyPlane; if( tpt > -1e-6 && tpt <= t && (dirToThatPoint - tpt * dirAtPolyPlane).SquareLength() < 1e-10 ) { diff --git a/code/IFCLoader.cpp b/code/IFCLoader.cpp index 856bca036..bd0ec700f 100644 --- a/code/IFCLoader.cpp +++ b/code/IFCLoader.cpp @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include +#include #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC # include "../contrib/unzip/unzip.h" diff --git a/code/XFileImporter.cpp b/code/XFileImporter.cpp index 7f6abd6e9..f95ba023d 100644 --- a/code/XFileImporter.cpp +++ b/code/XFileImporter.cpp @@ -52,7 +52,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include "../include/assimp/scene.h" #include "../include/assimp/DefaultLogger.hpp" -#include #include "Defines.h" #include "TinyFormatter.h" #include diff --git a/code/XFileParser.cpp b/code/XFileParser.cpp index 8bbbc64ac..fc3752be8 100644 --- a/code/XFileParser.cpp +++ b/code/XFileParser.cpp @@ -49,7 +49,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fast_atof.h" #include "Exceptional.h" #include "TinyFormatter.h" -#include #include "ByteSwapper.h" #include "../include/assimp/DefaultLogger.hpp" @@ -731,7 +730,7 @@ void XFileParser::ParseDataObjectMaterial( Material* pMaterial) std::string matName; readHeadOfDataObject( &matName); if( matName.empty()) - matName = std::string( "material") + boost::lexical_cast( mLineNumber); + matName = std::string( "material") + std::to_string( mLineNumber ); pMaterial->mName = matName; pMaterial->mIsReference = false; diff --git a/tools/assimp_view/AnimEvaluator.h b/tools/assimp_view/AnimEvaluator.h index 8e61f07f4..60d5c299d 100644 --- a/tools/assimp_view/AnimEvaluator.h +++ b/tools/assimp_view/AnimEvaluator.h @@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef AV_ANIMEVALUATOR_H_INCLUDED #define AV_ANIMEVALUATOR_H_INCLUDED -#include +#include namespace AssimpView { @@ -80,7 +80,7 @@ protected: * Useful to quickly find the corresponding frame for slightly increased time stamps */ double mLastTime; - std::vector > mLastPositions; + std::vector > mLastPositions; /** The array to store the transformations results of the evaluation */ std::vector mTransforms;