vrshoot

diff libs/assimp/StdOStreamLogStream.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/assimp/StdOStreamLogStream.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,52 @@
     1.4 +#ifndef AI_STROSTREAMLOGSTREAM_H_INC
     1.5 +#define AI_STROSTREAMLOGSTREAM_H_INC
     1.6 +
     1.7 +#include "assimp/LogStream.hpp"
     1.8 +#include <ostream>
     1.9 +
    1.10 +namespace Assimp	{
    1.11 +
    1.12 +// ---------------------------------------------------------------------------
    1.13 +/**	@class	StdOStreamLogStream
    1.14 + *	@brief	Logs into a std::ostream
    1.15 + */
    1.16 +class StdOStreamLogStream : public LogStream
    1.17 +{
    1.18 +public:
    1.19 +	/**	@brief	Construction from an existing std::ostream	
    1.20 +	 *  @param _ostream Output stream to be used
    1.21 +	*/
    1.22 +	StdOStreamLogStream(std::ostream& _ostream);
    1.23 +
    1.24 +	/**	@brief	Destructor	*/
    1.25 +	~StdOStreamLogStream();
    1.26 +	
    1.27 +	/**	@brief	Writer	*/
    1.28 +	void write(const char* message);
    1.29 +private:
    1.30 +	std::ostream& ostream;
    1.31 +};
    1.32 +
    1.33 +// ---------------------------------------------------------------------------
    1.34 +//	Default constructor
    1.35 +inline StdOStreamLogStream::StdOStreamLogStream(std::ostream& _ostream)
    1.36 +	: ostream	(_ostream)
    1.37 +{}
    1.38 +
    1.39 +// ---------------------------------------------------------------------------
    1.40 +//	Default constructor
    1.41 +inline StdOStreamLogStream::~StdOStreamLogStream()
    1.42 +{}
    1.43 +
    1.44 +// ---------------------------------------------------------------------------
    1.45 +//	Write method
    1.46 +inline void StdOStreamLogStream::write(const char* message)
    1.47 +{
    1.48 +	ostream << message;
    1.49 +	ostream.flush();
    1.50 +}
    1.51 +
    1.52 +// ---------------------------------------------------------------------------
    1.53 +}	// Namespace Assimp
    1.54 +
    1.55 +#endif // guard