catch_reporter_registry.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Created by Martin on 31/08/2017.
  3. *
  4. * Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. */
  7. #include "catch_reporter_registry.h"
  8. namespace Catch {
  9. ReporterRegistry::~ReporterRegistry() = default;
  10. IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {
  11. auto it = m_factories.find( name );
  12. if( it == m_factories.end() )
  13. return nullptr;
  14. return it->second->create( ReporterConfig( config ) );
  15. }
  16. void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
  17. m_factories.emplace(name, factory);
  18. }
  19. void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {
  20. m_listeners.push_back( factory );
  21. }
  22. IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {
  23. return m_factories;
  24. }
  25. IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const {
  26. return m_listeners;
  27. }
  28. }