Specs
Beautiful C++ Test Framework
Loading...
Searching...
No Matches
SpecTagCollection.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_set<std::string> _tags;
12
13 void merge_foreach(const char* value) { add(value); }
14
15 FunctionPointer<void(const char*)> _merge_foreach =
16 function_pointer(this, &SpecTagCollection::merge_foreach);
17
18 public:
19 void add(const char* value) override { _tags.emplace(value); }
20 bool has(const char* key) const override {
21 auto found = _tags.find(key);
22 return found != _tags.end();
23 }
24 void foreach_tag(ForEachTagFn* fn) const override {
25 for (auto& tag : _tags) fn->invoke(tag.c_str());
26 }
27 void merge(ISpecTagCollection* other) override { other->foreach_tag(&_merge_foreach); }
28 void clear() override { _tags.clear(); }
29 };
30}
void merge(ISpecTagCollection *other) override
void foreach_tag(ForEachTagFn *fn) const override
void add(const char *value) override
bool has(const char *key) const override
Definition API.h:3
virtual void foreach_tag(ForEachTagFn *) const =0
IFunctionPointer< void(const char *)> ForEachTagFn
Definition API.h:112