/ externals / catch / src / catch2 / reporters / catch_reporter_common_base.cpp
catch_reporter_common_base.cpp
 1  
 2  //              Copyright Catch2 Authors
 3  // Distributed under the Boost Software License, Version 1.0.
 4  //   (See accompanying file LICENSE.txt or copy at
 5  //        https://www.boost.org/LICENSE_1_0.txt)
 6  
 7  // SPDX-License-Identifier: BSL-1.0
 8  
 9  #include <catch2/reporters/catch_reporter_common_base.hpp>
10  
11  #include <catch2/reporters/catch_reporter_helpers.hpp>
12  #include <catch2/internal/catch_console_colour.hpp>
13  #include <catch2/internal/catch_istream.hpp>
14  
15  
16  namespace Catch {
17      ReporterBase::ReporterBase( ReporterConfig&& config ):
18          IEventListener( config.fullConfig() ),
19          m_wrapped_stream( CATCH_MOVE(config).takeStream() ),
20          m_stream( m_wrapped_stream->stream() ),
21          m_colour( makeColourImpl( config.colourMode(), m_wrapped_stream.get() ) ),
22          m_customOptions( config.customOptions() )
23      {}
24  
25      ReporterBase::~ReporterBase() = default;
26  
27      void ReporterBase::listReporters(
28          std::vector<ReporterDescription> const& descriptions ) {
29          defaultListReporters(m_stream, descriptions, m_config->verbosity());
30      }
31  
32      void ReporterBase::listListeners(
33          std::vector<ListenerDescription> const& descriptions ) {
34          defaultListListeners( m_stream, descriptions );
35      }
36  
37      void ReporterBase::listTests(std::vector<TestCaseHandle> const& tests) {
38          defaultListTests(m_stream,
39                           m_colour.get(),
40                           tests,
41                           m_config->hasTestFilters(),
42                           m_config->verbosity());
43      }
44  
45      void ReporterBase::listTags(std::vector<TagInfo> const& tags) {
46          defaultListTags( m_stream, tags, m_config->hasTestFilters() );
47      }
48  
49  } // namespace Catch