Specs
Beautiful C++ Test Framework
Loading...
Searching...
No Matches
SpecsCpp::SpecRunnerCollection Class Reference

#include <SpecRunnerCollection.h>

Inheritance diagram for SpecsCpp::SpecRunnerCollection:
SpecsCpp::ISpecRunnerCollection

Public Member Functions

void add (const char *name, ISpecRunner *runner) override
 
bool has (const char *name) const override
 
ISpecRunnerget (const char *name) const override
 
void foreach_runner (ForEachRunnerFn *fn) const override
 
- Public Member Functions inherited from SpecsCpp::ISpecRunnerCollection
virtual ~ISpecRunnerCollection ()=default
 
virtual void add (const char *, ISpecRunner *)=0
 
virtual bool has (const char *name) const =0
 
virtual ISpecRunnerget (const char *name) const =0
 
virtual void foreach_runner (ForEachRunnerFn *) const =0
 
void foreach_runner (std::function< void(const char *, ISpecRunner *)> fn) const
 

Additional Inherited Members

- Public Types inherited from SpecsCpp::ISpecRunnerCollection
using ForEachRunnerFn = IFunctionPointer< void(const char *, ISpecRunner *)>
 

Detailed Description

Definition at line 10 of file SpecRunnerCollection.h.

Member Function Documentation

◆ add()

void SpecsCpp::SpecRunnerCollection::add ( const char *  name,
ISpecRunner runner 
)
inlineoverridevirtual

Implements SpecsCpp::ISpecRunnerCollection.

Definition at line 14 of file SpecRunnerCollection.h.

14{ _runners[name] = runner; }

◆ foreach_runner()

void SpecsCpp::SpecRunnerCollection::foreach_runner ( ForEachRunnerFn fn) const
inlineoverridevirtual

Implements SpecsCpp::ISpecRunnerCollection.

Definition at line 27 of file SpecRunnerCollection.h.

27 {
28 for (const auto& [name, runner] : _runners) fn->invoke(name.c_str(), runner);
29 }

◆ get()

ISpecRunner * SpecsCpp::SpecRunnerCollection::get ( const char *  name) const
inlineoverridevirtual

Implements SpecsCpp::ISpecRunnerCollection.

Definition at line 21 of file SpecRunnerCollection.h.

21 {
22 auto found = _runners.find(name);
23 if (found != _runners.end()) return found->second;
24 return nullptr;
25 }

◆ has()

bool SpecsCpp::SpecRunnerCollection::has ( const char *  name) const
inlineoverridevirtual

Implements SpecsCpp::ISpecRunnerCollection.

Definition at line 16 of file SpecRunnerCollection.h.

16 {
17 auto found = _runners.find(name);
18 return found != _runners.end();
19 }

The documentation for this class was generated from the following file: