From 8255acf88fa86e1e7d80ab48d7ee1d1c8b05b57a Mon Sep 17 00:00:00 2001
From: Phil Nash <github@philnash.me>
Date: Fri, 30 Nov 2012 19:29:03 +0000
Subject: [PATCH] =?UTF-8?q?IStreamingReporter=20is=20now=20the=20default.?=
 =?UTF-8?q?=20Use=20REGISTER=5FLEGACY=5FREPORTER=20to=20register=E2=80=A6?=
 =?UTF-8?q?=20you=20guessed=20it:=20legacy=20reporters=20The=20built-in=20?=
 =?UTF-8?q?reporters=20are=20still=20legacy=20at=20the=20moment.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 include/catch.hpp                              |  2 ++
 include/internal/catch_impl.hpp                |  6 +++---
 include/internal/catch_reporter_registrars.hpp | 15 +++++++++++++--
 projects/SelfTest/catch_self_test.cpp          |  2 +-
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/include/catch.hpp b/include/catch.hpp
index 54acd738..6fb0fd10 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -84,6 +84,7 @@
 #define CATCH_METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
 
 #define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
+#define CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
 
 #define CATCH_GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
 
@@ -126,6 +127,7 @@
 #define METHOD_AS_TEST_CASE( method, name, description ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, name, description )
 
 #define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
+#define REGISTER_LEGACY_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType )
 
 #define GENERATE( expr) INTERNAL_CATCH_GENERATE( expr )
 
diff --git a/include/internal/catch_impl.hpp b/include/internal/catch_impl.hpp
index 295bf773..014a6345 100644
--- a/include/internal/catch_impl.hpp
+++ b/include/internal/catch_impl.hpp
@@ -76,9 +76,9 @@ namespace Catch {
 
     void Config::dummy() {}
 
-    INTERNAL_CATCH_REGISTER_REPORTER( "basic", BasicReporter )
-    INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
-    INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "basic", BasicReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "xml", XmlReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "junit", JunitReporter )
 
 }
 
diff --git a/include/internal/catch_reporter_registrars.hpp b/include/internal/catch_reporter_registrars.hpp
index 77ed5374..3496999f 100644
--- a/include/internal/catch_reporter_registrars.hpp
+++ b/include/internal/catch_reporter_registrars.hpp
@@ -38,6 +38,17 @@ namespace Catch {
 
         class ReporterFactory : public IReporterFactory {
 
+            // *** Please Note ***:
+            // - If you end up here looking at a compiler error because it's trying to register
+            // your custom reporter class be aware that the native reporter interface has changed
+            // to IStreamingReporter. The "legacy" interface, IReporter, is still supported via
+            // an adapter. Just use REGISTER_LEGACY_REPORTER to take advantage of the adapter.
+            // However please consider updating to the new interface as the old one is now
+            // deprecated and will probably be removed quite soon!
+            // Please contact me via github if you have any questions at all about this.
+            // In fact, ideally, please contact me anyway to let me know you've hit this - as I have
+            // no idea who is actually using custom reporters at all (possibly no-one!).
+            // The new interface is designed to minimise exposure to interface changes in the future.
             virtual IStreamingReporter* create( const ReporterConfig& config ) const {
                 return new T( config );
             }
@@ -55,9 +66,9 @@ namespace Catch {
     }; 
 }
 
-#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
+#define INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) \
     Catch::LegacyReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
-#define INTERNAL_CATCH_REGISTER_REPORTER2( name, reporterType ) \
+#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
     Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name );
 
 #endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
diff --git a/projects/SelfTest/catch_self_test.cpp b/projects/SelfTest/catch_self_test.cpp
index 3182b884..f2bfb8db 100644
--- a/projects/SelfTest/catch_self_test.cpp
+++ b/projects/SelfTest/catch_self_test.cpp
@@ -106,6 +106,6 @@ namespace Catch{
     const std::string MockReporter::recordTestCases = "[tc]";
     const std::string MockReporter::recordSections =" [s]";
     
-    INTERNAL_CATCH_REGISTER_REPORTER( "mock", MockReporter )
+    INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( "mock", MockReporter )
     
 }