noboost: Add working implementation for boost.format to get proper Collada error messages. See https://sourceforge.net/projects/assimp/forums/forum/817654/topic/3820367.
Add unit test for this. Fix build errors due to invalid pch settings in vc9 | release-noboost. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@798 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
9623663671
commit
20cc623ecd
|
@ -1,7 +1,7 @@
|
|||
|
||||
|
||||
|
||||
/* DEPRECATED placebo workaround, use code/TinyFormatter.h instead.
|
||||
/* DEPRECATED! - use code/TinyFormatter.h instead.
|
||||
*
|
||||
*
|
||||
* */
|
||||
|
@ -12,14 +12,14 @@
|
|||
#ifndef BOOST_FORMAT_HPP
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
class str;
|
||||
|
||||
|
||||
class format
|
||||
{
|
||||
friend class str;
|
||||
public:
|
||||
format (const std::string& _d)
|
||||
: d(_d)
|
||||
|
@ -27,26 +27,53 @@ namespace boost
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
const format& operator % (T in) const
|
||||
format& operator % (T in)
|
||||
{
|
||||
// XXX add replacement for boost::lexical_cast?
|
||||
|
||||
std::stringstream ss;
|
||||
ss << in; // note: ss cannot be an rvalue, or the global operator << (const char*) is not called for T == const char*.
|
||||
chunks.push_back( ss.str());
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
operator std::string () const {
|
||||
std::string res; // pray for NRVO to kick in
|
||||
|
||||
size_t start = 0, last = 0;
|
||||
|
||||
std::vector<std::string>::const_iterator chunkin = chunks.begin();
|
||||
|
||||
for ( start = d.find('%');start != std::string::npos; start = d.find('%',last)) {
|
||||
res += d.substr(last,start-last);
|
||||
last = start+2;
|
||||
if (d[start+1] == '%') {
|
||||
res += "%";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (chunkin == chunks.end()) {
|
||||
break;
|
||||
}
|
||||
|
||||
res += *chunkin++;
|
||||
}
|
||||
res += d.substr(last);
|
||||
return res;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string d;
|
||||
std::vector<std::string> chunks;
|
||||
};
|
||||
|
||||
class str : public std::string
|
||||
{
|
||||
public:
|
||||
|
||||
str(const format& f)
|
||||
{
|
||||
*((std::string* const)this) = std::string( f.d );
|
||||
}
|
||||
};
|
||||
inline std::string str(const std::string& s) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
# error "format.h was already included"
|
||||
#endif //
|
||||
|
|
|
@ -112,6 +112,8 @@ SOURCE_GROUP( tests FILES
|
|||
unit/utTriangulate.h
|
||||
unit/utVertexTriangleAdjacency.cpp
|
||||
unit/utVertexTriangleAdjacency.h
|
||||
unit/utNoBoostTest.cpp
|
||||
unit/utNoBoostTest.h
|
||||
)
|
||||
|
||||
add_executable( unit
|
||||
|
@ -158,6 +160,8 @@ add_executable( unit
|
|||
unit/utTriangulate.h
|
||||
unit/utVertexTriangleAdjacency.cpp
|
||||
unit/utVertexTriangleAdjacency.h
|
||||
unit/utNoBoostTest.cpp
|
||||
unit/utNoBoostTest.h
|
||||
unit/BoostWorkaround/tupletest.cpp
|
||||
../contrib/cppunit-1.12.1/src/cppunit/AdditionalMessage.cpp
|
||||
../contrib/cppunit-1.12.1/src/cppunit/Asserter.cpp
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
#include "UnitTestPCH.h"
|
||||
#include "utNoBoostTest.h"
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION (NoBoostTest);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void NoBoostTest :: testFormat()
|
||||
{
|
||||
|
||||
CPPUNIT_ASSERT( noboost::str( noboost::format("Ahoi!") ) == "Ahoi!" );
|
||||
CPPUNIT_ASSERT( noboost::str( noboost::format("Ahoi! %%") ) == "Ahoi! %" );
|
||||
CPPUNIT_ASSERT( noboost::str( noboost::format("Ahoi! %s") ) == "Ahoi! " );
|
||||
CPPUNIT_ASSERT( noboost::str( noboost::format("Ahoi! %s") % "!!" ) == "Ahoi! !!" );
|
||||
CPPUNIT_ASSERT( noboost::str( noboost::format("Ahoi! %s") % "!!" % "!!" ) == "Ahoi! !!" );
|
||||
CPPUNIT_ASSERT( noboost::str( noboost::format("%s%s%s") % "a" % std::string("b") % "c" ) == "abc" );
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef TESTNOBOOST_H
|
||||
#define TESTNOBOOST_H
|
||||
|
||||
namespace noboost {
|
||||
|
||||
#include "..\..\code\BoostWorkaround\boost\format.hpp"
|
||||
using boost::format;
|
||||
using boost::str;
|
||||
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
using namespace Assimp;
|
||||
|
||||
class NoBoostTest : public CPPUNIT_NS :: TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE (NoBoostTest);
|
||||
CPPUNIT_TEST (testFormat);
|
||||
CPPUNIT_TEST_SUITE_END ();
|
||||
|
||||
public:
|
||||
void setUp (void) {
|
||||
}
|
||||
void tearDown (void) {
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void testFormat (void);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -3420,6 +3420,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|Win32"
|
||||
>
|
||||
|
@ -3428,6 +3436,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|Win32"
|
||||
>
|
||||
|
@ -3436,6 +3452,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|Win32"
|
||||
>
|
||||
|
@ -3444,6 +3468,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3452,6 +3484,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3460,6 +3500,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|Win32"
|
||||
>
|
||||
|
@ -3468,6 +3516,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|Win32"
|
||||
>
|
||||
|
@ -3476,6 +3532,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\contrib\unzip\ioapi.h"
|
||||
|
@ -3492,6 +3556,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|Win32"
|
||||
>
|
||||
|
@ -3500,6 +3572,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|Win32"
|
||||
>
|
||||
|
@ -3508,6 +3588,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|Win32"
|
||||
>
|
||||
|
@ -3516,6 +3604,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3524,6 +3620,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3532,6 +3636,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|Win32"
|
||||
>
|
||||
|
@ -3540,6 +3652,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|Win32"
|
||||
>
|
||||
|
@ -3548,6 +3668,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\contrib\unzip\unzip.h"
|
||||
|
@ -3576,6 +3704,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|Win32"
|
||||
>
|
||||
|
@ -3584,6 +3720,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|Win32"
|
||||
>
|
||||
|
@ -3592,6 +3736,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|Win32"
|
||||
>
|
||||
|
@ -3600,6 +3752,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3608,6 +3768,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3616,6 +3784,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|Win32"
|
||||
>
|
||||
|
@ -3624,6 +3800,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|Win32"
|
||||
>
|
||||
|
@ -3632,6 +3816,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\contrib\zlib\zutil.h"
|
||||
|
@ -3652,6 +3844,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|Win32"
|
||||
>
|
||||
|
@ -3660,6 +3860,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|Win32"
|
||||
>
|
||||
|
@ -3668,6 +3876,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|Win32"
|
||||
>
|
||||
|
@ -3676,6 +3892,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-dll|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3684,6 +3908,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|Win32"
|
||||
>
|
||||
|
@ -3692,6 +3924,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-noboost-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|Win32"
|
||||
>
|
||||
|
@ -3700,6 +3940,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="debug-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|Win32"
|
||||
>
|
||||
|
@ -3708,6 +3956,14 @@
|
|||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="release-st|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
UsePrecompiledHeader="0"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\contrib\ConvertUTF\ConvertUTF.h"
|
||||
|
|
Loading…
Reference in New Issue