2013-12-03 19:52:41 +01:00
|
|
|
/*
|
|
|
|
* Created by Phil on 2/12/2013.
|
|
|
|
* Copyright 2013 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
|
|
|
|
#define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
|
|
|
|
|
2017-11-07 16:55:09 +01:00
|
|
|
#include <iosfwd>
|
2017-11-07 19:01:10 +01:00
|
|
|
#include <cstddef>
|
|
|
|
#include <ostream>
|
2013-12-03 19:52:41 +01:00
|
|
|
|
|
|
|
namespace Catch {
|
|
|
|
|
2015-09-29 20:21:08 +02:00
|
|
|
std::ostream& cout();
|
|
|
|
std::ostream& cerr();
|
2017-08-09 15:28:40 +02:00
|
|
|
std::ostream& clog();
|
2015-09-29 20:21:08 +02:00
|
|
|
|
2017-11-07 16:55:09 +01:00
|
|
|
class StringRef;
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-09-29 20:21:08 +02:00
|
|
|
struct IStream {
|
2017-09-07 16:51:33 +02:00
|
|
|
virtual ~IStream();
|
2015-09-29 20:21:08 +02:00
|
|
|
virtual std::ostream& stream() const = 0;
|
|
|
|
};
|
|
|
|
|
2017-11-07 16:55:09 +01:00
|
|
|
auto makeStream( StringRef const &filename ) -> IStream const*;
|
2017-11-07 19:01:10 +01:00
|
|
|
|
|
|
|
class ReusableStringStream {
|
|
|
|
std::size_t m_index;
|
|
|
|
std::ostream* m_oss;
|
|
|
|
public:
|
|
|
|
ReusableStringStream();
|
|
|
|
~ReusableStringStream();
|
|
|
|
|
|
|
|
auto str() const -> std::string;
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
auto operator << ( T const& value ) -> ReusableStringStream& {
|
|
|
|
*m_oss << value;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
auto get() -> std::ostream& { return *m_oss; }
|
|
|
|
};
|
2013-12-03 19:52:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
|