1 /* 2 * Created by Phil on 5/8/2012. 3 * Copyright 2012 Two Blue Cubes Ltd. All rights reserved. 4 * 5 * Distributed under the Boost Software License, Version 1.0. (See accompanying 6 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 7 */ 8 #ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED 9 #define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED 10 11 #include "catch_common.h" 12 13 #include <string> 14 #include <memory> 15 16 namespace Catch { 17 18 class TestCase; 19 struct ITestCaseRegistry; 20 struct IExceptionTranslatorRegistry; 21 struct IExceptionTranslator; 22 struct IReporterRegistry; 23 struct IReporterFactory; 24 struct ITagAliasRegistry; 25 class StartupExceptionRegistry; 26 27 using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>; 28 29 struct IRegistryHub { 30 virtual ~IRegistryHub(); 31 32 virtual IReporterRegistry const& getReporterRegistry() const = 0; 33 virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; 34 virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; 35 36 virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; 37 38 39 virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; 40 }; 41 42 struct IMutableRegistryHub { 43 virtual ~IMutableRegistryHub(); 44 virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; 45 virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; 46 virtual void registerTest( TestCase const& testInfo ) = 0; 47 virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; 48 virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; 49 virtual void registerStartupException() noexcept = 0; 50 }; 51 52 IRegistryHub const& getRegistryHub(); 53 IMutableRegistryHub& getMutableRegistryHub(); 54 void cleanUp(); 55 std::string translateActiveException(); 56 57 } 58 59 #endif // TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED 60