Major API cleanup. Unified formatting & doxygen tags in the public API.
Added factory provider for default log streams. Added default log streams to std::out and std::cerr. Updated VC8 project config, boost workarounds is now working for the viewer. Updated unit test suite. Fixed some minor issues in the postprocessing-framework. BROKEN: DebugDLL build. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@292 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
#include "../include/LogStream.h"
|
||||
#include "../include/IOStream.h"
|
||||
|
||||
namespace Assimp
|
||||
{
|
||||
namespace Assimp {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
/** @class FileLogStream
|
||||
* @brief Logstream to write into a file.
|
||||
*/
|
||||
@@ -15,52 +15,57 @@ class FileLogStream :
|
||||
public LogStream
|
||||
{
|
||||
public:
|
||||
FileLogStream( const std::string &strFileName );
|
||||
FileLogStream( const std::string &strFileName, IOSystem* io = NULL );
|
||||
~FileLogStream();
|
||||
void write( const std::string &message );
|
||||
|
||||
private:
|
||||
IOStream *m_pStream;
|
||||
};
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Constructor
|
||||
inline FileLogStream::FileLogStream( const std::string &strFileName ) :
|
||||
inline FileLogStream::FileLogStream( const std::string &strFileName, IOSystem* io ) :
|
||||
m_pStream(NULL)
|
||||
{
|
||||
if ( strFileName.empty() )
|
||||
return;
|
||||
|
||||
DefaultIOSystem FileSystem;
|
||||
const std::string mode = "w";
|
||||
m_pStream = FileSystem.Open( strFileName, mode );
|
||||
|
||||
const static std::string mode = "wt";
|
||||
|
||||
// If no IOSystem is specified: take a default one
|
||||
if (!io)
|
||||
{
|
||||
DefaultIOSystem FileSystem;
|
||||
m_pStream = FileSystem.Open( strFileName, mode );
|
||||
}
|
||||
else m_pStream = io->Open( strFileName, mode );
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Destructor
|
||||
inline FileLogStream::~FileLogStream()
|
||||
{
|
||||
if (NULL != m_pStream)
|
||||
{
|
||||
DefaultIOSystem FileSystem;
|
||||
FileSystem.Close( m_pStream );
|
||||
}
|
||||
// The virtual d'tor should destroy the underlying file
|
||||
delete m_pStream;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
// Write method
|
||||
inline void FileLogStream::write( const std::string &message )
|
||||
{
|
||||
if (m_pStream != NULL)
|
||||
{
|
||||
m_pStream->Write(message.c_str(), sizeof(char),
|
||||
message.size());
|
||||
/*int i=0;
|
||||
i++;*/
|
||||
m_pStream->Write(message.c_str(), sizeof(char), message.size());
|
||||
m_pStream->Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
} // Namespace Assimp
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
#endif
|
||||
} // !Namespace Assimp
|
||||
|
||||
#endif // !! ASSIMP_FILELOGSTREAM_H_INC
|
||||
|
||||
Reference in New Issue
Block a user