Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
catch_registry_hub.cpp
Go to the documentation of this file.
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
10
11#include "catch_context.h"
17#include "catch_singletons.hpp"
19
20namespace Catch {
21
22 namespace {
23
24 class RegistryHub : public IRegistryHub, public IMutableRegistryHub,
25 private NonCopyable {
26
27 public: // IRegistryHub
28 RegistryHub() = default;
29 IReporterRegistry const& getReporterRegistry() const override {
30 return m_reporterRegistry;
31 }
32 ITestCaseRegistry const& getTestCaseRegistry() const override {
33 return m_testCaseRegistry;
34 }
35 IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override {
36 return m_exceptionTranslatorRegistry;
37 }
38 ITagAliasRegistry const& getTagAliasRegistry() const override {
39 return m_tagAliasRegistry;
40 }
41 StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
42 return m_exceptionRegistry;
43 }
44
45 public: // IMutableRegistryHub
46 void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
47 m_reporterRegistry.registerReporter( name, factory );
48 }
49 void registerListener( IReporterFactoryPtr const& factory ) override {
50 m_reporterRegistry.registerListener( factory );
51 }
52 void registerTest( TestCase const& testInfo ) override {
53 m_testCaseRegistry.registerTest( testInfo );
54 }
55 void registerTranslator( const IExceptionTranslator* translator ) override {
56 m_exceptionTranslatorRegistry.registerTranslator( translator );
57 }
58 void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
59 m_tagAliasRegistry.add( alias, tag, lineInfo );
60 }
61 void registerStartupException() noexcept override {
62 m_exceptionRegistry.add(std::current_exception());
63 }
64 IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
65 return m_enumValuesRegistry;
66 }
67
68 private:
69 TestRegistry m_testCaseRegistry;
70 ReporterRegistry m_reporterRegistry;
71 ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
72 TagAliasRegistry m_tagAliasRegistry;
73 StartupExceptionRegistry m_exceptionRegistry;
74 Detail::EnumValuesRegistry m_enumValuesRegistry;
75 };
76 }
77
79
86 void cleanUp() {
89 }
93
94
95} // end namespace Catch
std::string name
static auto getMutable() -> MutableInterfaceT &
static auto get() -> InterfaceT const &
IMutableRegistryHub & getMutableRegistryHub()
IRegistryHub const & getRegistryHub()
std::shared_ptr< IReporterFactory > IReporterFactoryPtr
void cleanupSingletons()
std::string translateActiveException()
void cleanUpContext()
virtual std::string translateActiveException() const =0
virtual IExceptionTranslatorRegistry const & getExceptionTranslatorRegistry() const =0