diff options
| author | Martin Hořeňovský | 2020-11-27 10:43:07 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-11-28 11:18:46 +0100 |
| commit | 1982c0d5eef1c68a4c5b652fda8575ab3db7a839 (patch) | |
| tree | 1568f451155150462376007318c5b9f2c72f5d30 /src/catch2 | |
| parent | 0442229dc93fab0be84a302e22a5d2ba7cf15159 (diff) | |
| download | catch3-1982c0d5eef1c68a4c5b652fda8575ab3db7a839.tar.gz | |
Split out the StreamEndStop helper into its own header
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/catch_all.hpp | 1 | ||||
| -rw-r--r-- | src/catch2/catch_message.hpp | 4 | ||||
| -rw-r--r-- | src/catch2/internal/catch_common.hpp | 16 | ||||
| -rw-r--r-- | src/catch2/internal/catch_stream_end_stop.hpp | 30 |
4 files changed, 34 insertions, 17 deletions
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index 6e93d54c..ed035223 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -83,6 +83,7 @@ #include <catch2/internal/catch_singletons.hpp> #include <catch2/internal/catch_startup_exception_registry.hpp> #include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_stream_end_stop.hpp> #include <catch2/internal/catch_string_manip.hpp> #include <catch2/internal/catch_stringref.hpp> #include <catch2/internal/catch_tag_alias_registry.hpp> diff --git a/src/catch2/catch_message.hpp b/src/catch2/catch_message.hpp index 21e666bc..db60b6bf 100644 --- a/src/catch2/catch_message.hpp +++ b/src/catch2/catch_message.hpp @@ -9,8 +9,8 @@ #define CATCH_MESSAGE_HPP_INCLUDED #include <catch2/internal/catch_result_type.hpp> -#include <catch2/internal/catch_common.hpp> #include <catch2/internal/catch_stream.hpp> +#include <catch2/internal/catch_stream_end_stop.hpp> #include <catch2/internal/catch_message_info.hpp> #include <catch2/interfaces/catch_interfaces_capture.hpp> #include <catch2/catch_tostring.hpp> @@ -20,6 +20,8 @@ namespace Catch { + struct SourceLineInfo; + struct MessageStream { template<typename T> diff --git a/src/catch2/internal/catch_common.hpp b/src/catch2/internal/catch_common.hpp index 8e13a90e..82360594 100644 --- a/src/catch2/internal/catch_common.hpp +++ b/src/catch2/internal/catch_common.hpp @@ -9,7 +9,6 @@ #define CATCH_COMMON_HPP_INCLUDED #include <catch2/internal/catch_compiler_capabilities.hpp> -#include <catch2/internal/catch_stringref.hpp> #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) @@ -49,21 +48,6 @@ namespace Catch { // This is necessary because the overload of operator<< above makes // lookup stop at namespace Catch using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - StringRef operator+() const { - return StringRef(); - } - - template<typename T> - friend T const& operator + ( T const& value, StreamEndStop ) { - return value; - } - }; } #define CATCH_INTERNAL_LINEINFO \ diff --git a/src/catch2/internal/catch_stream_end_stop.hpp b/src/catch2/internal/catch_stream_end_stop.hpp new file mode 100644 index 00000000..452ca1e9 --- /dev/null +++ b/src/catch2/internal/catch_stream_end_stop.hpp @@ -0,0 +1,30 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED +#define CATCH_STREAM_END_STOP_HPP_INCLUDED + +#include <catch2/internal/catch_stringref.hpp> + +namespace Catch { + + // Use this in variadic streaming macros to allow + // << +StreamEndStop + // as well as + // << stuff +StreamEndStop + struct StreamEndStop { + StringRef operator+() const { return StringRef(); } + + template <typename T> + friend T const& operator+( T const& value, StreamEndStop ) { + return value; + } + }; + +} // namespace Catch + +#endif // CATCH_STREAM_END_STOP_HPP_INCLUDED |