Class ReporterBase

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class ReporterBase : public Catch::IEventListener

This is the base class for all reporters.

If are writing a reporter, you must derive from this type, or one of the helper reporter bases that are derived from this type.

ReporterBase centralizes handling of various common tasks in reporters, like storing the right stream for the reporters to write to, and providing the default implementation of the different listing events.

Subclassed by Catch::StreamingReporterBase

Public Functions

ReporterBase(ReporterConfig &&config)
~ReporterBase() override
virtual void listReporters(std::vector<ReporterDescription> const &descriptions) override

Provides a simple default listing of reporters.

Should look roughly like the reporter listing in v2 and earlier versions of Catch2.

virtual void listListeners(std::vector<ListenerDescription> const &descriptions) override

Provides a simple default listing of listeners

Looks similarly to listing of reporters, but with listener type instead of reporter name.

virtual void listTests(std::vector<TestCaseHandle> const &tests) override

Provides a simple default listing of tests.

Should look roughly like the test listing in v2 and earlier versions of Catch2. Especially supports low-verbosity listing that mimics the old --list-test-names-only output.

virtual void listTags(std::vector<TagInfo> const &tags) override

Provides a simple default listing of tags.

Should look roughly like the tag listing in v2 and earlier versions of Catch2.

Protected Attributes

Detail::unique_ptr<IStream> m_wrapped_stream

The stream wrapper as passed to us by outside code.

std::ostream &m_stream

Cached output stream from m_wrapped_stream to reduce number of indirect calls needed to write output.

Detail::unique_ptr<ColourImpl> m_colour

Colour implementation this reporter was configured for.

std::map<std::string, std::string> m_customOptions

The custom reporter options user passed down to the reporter.