mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Split writeToDebugConsole out of main path
This commit is contained in:
		| @@ -132,6 +132,7 @@ set(INTERNAL_HEADERS | |||||||
|         ${HEADER_DIR}/internal/catch_config.hpp |         ${HEADER_DIR}/internal/catch_config.hpp | ||||||
|         ${HEADER_DIR}/internal/catch_console_colour.hpp |         ${HEADER_DIR}/internal/catch_console_colour.hpp | ||||||
|         ${HEADER_DIR}/internal/catch_context.h |         ${HEADER_DIR}/internal/catch_context.h | ||||||
|  |         ${HEADER_DIR}/internal/catch_debug_console.h | ||||||
|         ${HEADER_DIR}/internal/catch_debugger.h |         ${HEADER_DIR}/internal/catch_debugger.h | ||||||
|         ${HEADER_DIR}/internal/catch_decomposer.h |         ${HEADER_DIR}/internal/catch_decomposer.h | ||||||
|         ${HEADER_DIR}/internal/catch_default_main.hpp |         ${HEADER_DIR}/internal/catch_default_main.hpp | ||||||
| @@ -203,6 +204,7 @@ set(IMPL_SOURCES | |||||||
|         ${HEADER_DIR}/internal/catch_config.cpp |         ${HEADER_DIR}/internal/catch_config.cpp | ||||||
|         ${HEADER_DIR}/internal/catch_console_colour.cpp |         ${HEADER_DIR}/internal/catch_console_colour.cpp | ||||||
|         ${HEADER_DIR}/internal/catch_context.cpp |         ${HEADER_DIR}/internal/catch_context.cpp | ||||||
|  |         ${HEADER_DIR}/internal/catch_debug_console.cpp | ||||||
|         ${HEADER_DIR}/internal/catch_debugger.cpp |         ${HEADER_DIR}/internal/catch_debugger.cpp | ||||||
|         ${HEADER_DIR}/internal/catch_decomposer.cpp |         ${HEADER_DIR}/internal/catch_decomposer.cpp | ||||||
|         ${HEADER_DIR}/internal/catch_errno_guard.cpp |         ${HEADER_DIR}/internal/catch_errno_guard.cpp | ||||||
|   | |||||||
							
								
								
									
										29
									
								
								include/internal/catch_debug_console.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								include/internal/catch_debug_console.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,29 @@ | |||||||
|  | /* | ||||||
|  |  *  Created by Martin on 29/08/2017. | ||||||
|  |  * | ||||||
|  |  *  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) | ||||||
|  |  * | ||||||
|  |  */ | ||||||
|  |  | ||||||
|  | #include "catch_debug_console.h" | ||||||
|  | #include "catch_stream.h" | ||||||
|  | #include "catch_platform.h" | ||||||
|  |  | ||||||
|  | #ifdef CATCH_PLATFORM_WINDOWS | ||||||
|  |  | ||||||
|  | #include "catch_windows_h_proxy.h" | ||||||
|  |  | ||||||
|  |     namespace Catch { | ||||||
|  |         void writeToDebugConsole( std::string const& text ) { | ||||||
|  |             ::OutputDebugStringA( text.c_str() ); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | #else | ||||||
|  |     namespace Catch { | ||||||
|  |         void writeToDebugConsole( std::string const& text ) { | ||||||
|  |             // !TBD: Need a version for Mac/ XCode and other IDEs | ||||||
|  |             Catch::cout() << text; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | #endif // Platform | ||||||
							
								
								
									
										17
									
								
								include/internal/catch_debug_console.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								include/internal/catch_debug_console.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | |||||||
|  | /* | ||||||
|  |  *  Created by Martin on 29/08/2017. | ||||||
|  |  * | ||||||
|  |  *  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_DEBUG_CONSOLE_H_INCLUDED | ||||||
|  | #define TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED | ||||||
|  |  | ||||||
|  | #include <string> | ||||||
|  |  | ||||||
|  | namespace Catch { | ||||||
|  |     void writeToDebugConsole( std::string const& text ); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #endif // TWOBLUECUBES_CATCH_DEBUG_CONSOLE_H_INCLUDED | ||||||
| @@ -109,21 +109,3 @@ | |||||||
|        bool isDebuggerActive() { return false; } |        bool isDebuggerActive() { return false; } | ||||||
|     } |     } | ||||||
| #endif // Platform | #endif // Platform | ||||||
|  |  | ||||||
| #ifdef CATCH_PLATFORM_WINDOWS |  | ||||||
|  |  | ||||||
| #include "catch_windows_h_proxy.h" |  | ||||||
|  |  | ||||||
|     namespace Catch { |  | ||||||
|         void writeToDebugConsole( std::string const& text ) { |  | ||||||
|             ::OutputDebugStringA( text.c_str() ); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #else |  | ||||||
|     namespace Catch { |  | ||||||
|         void writeToDebugConsole( std::string const& text ) { |  | ||||||
|             // !TBD: Need a version for Mac/ XCode and other IDEs |  | ||||||
|             Catch::cout() << text; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| #endif // Platform |  | ||||||
|   | |||||||
| @@ -11,12 +11,8 @@ | |||||||
|  |  | ||||||
| #include "catch_platform.h" | #include "catch_platform.h" | ||||||
|  |  | ||||||
| #include <string> | namespace Catch { | ||||||
|  |  | ||||||
| namespace Catch{ |  | ||||||
|  |  | ||||||
|     bool isDebuggerActive(); |     bool isDebuggerActive(); | ||||||
|     void writeToDebugConsole( std::string const& text ); |  | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef CATCH_PLATFORM_MAC | #ifdef CATCH_PLATFORM_MAC | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ | |||||||
| #include "catch_common.h" | #include "catch_common.h" | ||||||
| #include "catch_enforce.h" | #include "catch_enforce.h" | ||||||
| #include "catch_stream.h" | #include "catch_stream.h" | ||||||
| #include "catch_debugger.h" | #include "catch_debug_console.h" | ||||||
|  |  | ||||||
| #include <stdexcept> | #include <stdexcept> | ||||||
| #include <cstdio> | #include <cstdio> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský