Specs
Beautiful C++ Test Framework
Loading...
Searching...
No Matches
SpecRunnerCollection.h
Go to the documentation of this file.
1#pragma once
2
3#include <Specs/API.h>
4#include <collections.h>
5
6#include <string>
7
8namespace SpecsCpp {
9
11 collections_map<std::string, ISpecRunner*> _runners;
12
13 public:
14 void add(const char* name, ISpecRunner* runner) override { _runners[name] = runner; }
15
16 bool has(const char* name) const override {
17 auto found = _runners.find(name);
18 return found != _runners.end();
19 }
20
21 ISpecRunner* get(const char* name) const override {
22 auto found = _runners.find(name);
23 if (found != _runners.end()) return found->second;
24 return nullptr;
25 }
26
27 void foreach_runner(ForEachRunnerFn* fn) const override {
28 for (const auto& [name, runner] : _runners) fn->invoke(name.c_str(), runner);
29 }
30 };
31}
ISpecRunner * get(const char *name) const override
void foreach_runner(ForEachRunnerFn *fn) const override
void add(const char *name, ISpecRunner *runner) override
bool has(const char *name) const override
Definition API.h:3
IFunctionPointer< void(const char *, ISpecRunner *)> ForEachRunnerFn
Definition API.h:495