You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.3 KiB

  1. #ifndef AI_STROSTREAMLOGSTREAM_H_INC
  2. #define AI_STROSTREAMLOGSTREAM_H_INC
  3. #include "../include/assimp/LogStream.hpp"
  4. #include <ostream>
  5. namespace Assimp {
  6. // ---------------------------------------------------------------------------
  7. /** @class StdOStreamLogStream
  8. * @brief Logs into a std::ostream
  9. */
  10. class StdOStreamLogStream : public LogStream
  11. {
  12. public:
  13. /** @brief Construction from an existing std::ostream
  14. * @param _ostream Output stream to be used
  15. */
  16. StdOStreamLogStream(std::ostream& _ostream);
  17. /** @brief Destructor */
  18. ~StdOStreamLogStream();
  19. /** @brief Writer */
  20. void write(const char* message);
  21. private:
  22. std::ostream& ostream;
  23. };
  24. // ---------------------------------------------------------------------------
  25. // Default constructor
  26. inline StdOStreamLogStream::StdOStreamLogStream(std::ostream& _ostream)
  27. : ostream (_ostream)
  28. {}
  29. // ---------------------------------------------------------------------------
  30. // Default constructor
  31. inline StdOStreamLogStream::~StdOStreamLogStream()
  32. {}
  33. // ---------------------------------------------------------------------------
  34. // Write method
  35. inline void StdOStreamLogStream::write(const char* message)
  36. {
  37. ostream << message;
  38. ostream.flush();
  39. }
  40. // ---------------------------------------------------------------------------
  41. } // Namespace Assimp
  42. #endif // guard