mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Split out the StreamEndStop helper into its own header
This commit is contained in:
parent
0442229dc9
commit
1982c0d5ee
@ -109,6 +109,7 @@ set(INTERNAL_HEADERS
|
|||||||
${SOURCES_DIR}/internal/catch_singletons.hpp
|
${SOURCES_DIR}/internal/catch_singletons.hpp
|
||||||
${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp
|
${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp
|
||||||
${SOURCES_DIR}/internal/catch_stream.hpp
|
${SOURCES_DIR}/internal/catch_stream.hpp
|
||||||
|
${SOURCES_DIR}/internal/catch_stream_end_stop.hpp
|
||||||
${SOURCES_DIR}/internal/catch_string_manip.hpp
|
${SOURCES_DIR}/internal/catch_string_manip.hpp
|
||||||
${SOURCES_DIR}/internal/catch_stringref.hpp
|
${SOURCES_DIR}/internal/catch_stringref.hpp
|
||||||
${SOURCES_DIR}/catch_tag_alias.hpp
|
${SOURCES_DIR}/catch_tag_alias.hpp
|
||||||
|
@ -83,6 +83,7 @@
|
|||||||
#include <catch2/internal/catch_singletons.hpp>
|
#include <catch2/internal/catch_singletons.hpp>
|
||||||
#include <catch2/internal/catch_startup_exception_registry.hpp>
|
#include <catch2/internal/catch_startup_exception_registry.hpp>
|
||||||
#include <catch2/internal/catch_stream.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_string_manip.hpp>
|
||||||
#include <catch2/internal/catch_stringref.hpp>
|
#include <catch2/internal/catch_stringref.hpp>
|
||||||
#include <catch2/internal/catch_tag_alias_registry.hpp>
|
#include <catch2/internal/catch_tag_alias_registry.hpp>
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
#define CATCH_MESSAGE_HPP_INCLUDED
|
#define CATCH_MESSAGE_HPP_INCLUDED
|
||||||
|
|
||||||
#include <catch2/internal/catch_result_type.hpp>
|
#include <catch2/internal/catch_result_type.hpp>
|
||||||
#include <catch2/internal/catch_common.hpp>
|
|
||||||
#include <catch2/internal/catch_stream.hpp>
|
#include <catch2/internal/catch_stream.hpp>
|
||||||
|
#include <catch2/internal/catch_stream_end_stop.hpp>
|
||||||
#include <catch2/internal/catch_message_info.hpp>
|
#include <catch2/internal/catch_message_info.hpp>
|
||||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||||
#include <catch2/catch_tostring.hpp>
|
#include <catch2/catch_tostring.hpp>
|
||||||
@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
|
struct SourceLineInfo;
|
||||||
|
|
||||||
struct MessageStream {
|
struct MessageStream {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#define CATCH_COMMON_HPP_INCLUDED
|
#define CATCH_COMMON_HPP_INCLUDED
|
||||||
|
|
||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
#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_LINE2( name, line ) name##line
|
||||||
#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( 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
|
// This is necessary because the overload of operator<< above makes
|
||||||
// lookup stop at namespace Catch
|
// lookup stop at namespace Catch
|
||||||
using ::operator<<;
|
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 \
|
#define CATCH_INTERNAL_LINEINFO \
|
||||||
|
30
src/catch2/internal/catch_stream_end_stop.hpp
Normal file
30
src/catch2/internal/catch_stream_end_stop.hpp
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user