assimp/code/StdOStreamLogStream.h

53 lines
1.4 KiB
C
Raw Normal View History

#ifndef AI_STROSTREAMLOGSTREAM_H_INC
#define AI_STROSTREAMLOGSTREAM_H_INC
#include "../include/assimp/LogStream.hpp"
#include <ostream>
2015-05-19 03:57:13 +00:00
namespace Assimp {
// ---------------------------------------------------------------------------
2015-05-19 03:57:13 +00:00
/** @class StdOStreamLogStream
* @brief Logs into a std::ostream
*/
class StdOStreamLogStream : public LogStream
{
public:
2015-05-19 03:57:13 +00:00
/** @brief Construction from an existing std::ostream
* @param _ostream Output stream to be used
*/
StdOStreamLogStream(std::ostream& _ostream);
2015-05-19 03:57:13 +00:00
/** @brief Destructor */
~StdOStreamLogStream();
2015-05-19 03:52:10 +00:00
2015-05-19 03:57:13 +00:00
/** @brief Writer */
void write(const char* message);
private:
2015-05-19 03:57:13 +00:00
std::ostream& ostream;
};
// ---------------------------------------------------------------------------
2015-05-19 03:57:13 +00:00
// Default constructor
inline StdOStreamLogStream::StdOStreamLogStream(std::ostream& _ostream)
2015-05-19 03:57:13 +00:00
: ostream (_ostream)
{}
// ---------------------------------------------------------------------------
2015-05-19 03:57:13 +00:00
// Default constructor
inline StdOStreamLogStream::~StdOStreamLogStream()
{}
// ---------------------------------------------------------------------------
2015-05-19 03:57:13 +00:00
// Write method
inline void StdOStreamLogStream::write(const char* message)
{
2015-05-19 03:57:13 +00:00
ostream << message;
ostream.flush();
}
// ---------------------------------------------------------------------------
2015-05-19 03:57:13 +00:00
} // Namespace Assimp
#endif // guard