Dialect interface.
More...
#include <Dialect.h>
|
virtual | ~Dialect ()=default |
|
template<typename ConcreteService > |
ConcreteService * | service (void) const |
|
|
template<typename ConcreteService > |
void | service (std::unique_ptr< ConcreteService > &&s) |
|
Dialect interface.
Each dialect implementation is expected to have static "get" method which returns "const Dialect *" value.
Definition at line 36 of file Dialect.h.
◆ ~Dialect()
virtual loco::Dialect::~Dialect |
( |
| ) |
|
|
virtualdefault |
◆ service() [1/2]
template<typename ConcreteService >
void loco::Dialect::service |
( |
std::unique_ptr< ConcreteService > && |
s | ) |
|
|
inlineprotected |
Definition at line 42 of file Dialect.h.
43 {
44 _services[typeid(ConcreteService)] = std::move(s);
45 }
◆ service() [2/2]
template<typename ConcreteService >
ConcreteService * loco::Dialect::service |
( |
void |
| ) |
const |
|
inline |
Definition at line 48 of file Dialect.h.
49 {
50 auto it = _services.find(typeid(ConcreteService));
51
52 if (it == _services.end())
53 {
54 return nullptr;
55 }
56
57 return dynamic_cast<ConcreteService *>(it->second.get());
58 }
The documentation for this class was generated from the following file: