2009-01-12 22:06:54 +00:00
|
|
|
#ifndef AI_STROSTREAMLOGSTREAM_H_INC
|
|
|
|
#define AI_STROSTREAMLOGSTREAM_H_INC
|
|
|
|
|
2012-02-03 17:04:06 +00:00
|
|
|
#include "../include/assimp/LogStream.hpp"
|
2009-01-12 22:06:54 +00:00
|
|
|
#include <ostream>
|
|
|
|
|
|
|
|
namespace Assimp {
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** @class StdOStreamLogStream
|
|
|
|
* @brief Logs into a std::ostream
|
|
|
|
*/
|
|
|
|
class StdOStreamLogStream : public LogStream
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** @brief Construction from an existing std::ostream
|
|
|
|
* @param _ostream Output stream to be used
|
|
|
|
*/
|
|
|
|
StdOStreamLogStream(std::ostream& _ostream);
|
|
|
|
|
|
|
|
/** @brief Destructor */
|
|
|
|
~StdOStreamLogStream();
|
|
|
|
|
|
|
|
/** @brief Writer */
|
2009-01-23 21:06:43 +00:00
|
|
|
void write(const char* message);
|
2009-01-12 22:06:54 +00:00
|
|
|
private:
|
|
|
|
std::ostream& ostream;
|
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Default constructor
|
|
|
|
inline StdOStreamLogStream::StdOStreamLogStream(std::ostream& _ostream)
|
|
|
|
: ostream (_ostream)
|
|
|
|
{}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Default constructor
|
|
|
|
inline StdOStreamLogStream::~StdOStreamLogStream()
|
|
|
|
{}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Write method
|
2009-01-23 21:06:43 +00:00
|
|
|
inline void StdOStreamLogStream::write(const char* message)
|
2009-01-12 22:06:54 +00:00
|
|
|
{
|
2009-01-23 21:06:43 +00:00
|
|
|
ostream << message;
|
2009-01-12 22:06:54 +00:00
|
|
|
ostream.flush();
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
} // Namespace Assimp
|
|
|
|
|
|
|
|
#endif // guard
|