#include <AttributeInjector.h>
|
template<InjectableAttribute Attribute, fixed_string key = ""> |
constexpr bool | setAttribute (const Attribute &attribute, const std::string &subKey="", bool overwrite=false) |
|
template<InjectableAttribute Attribute, fixed_string key = ""> |
constexpr bool | setAttribute (const Attribute &&attribute, const std::string &subKey="", bool overwrite=false) |
|
template<InjectableAttribute Attribute, fixed_string key = ""> |
constexpr bool | delAttribute (const std::string &subKey="") |
|
template<InjectableAttribute Attribute, fixed_string key = ""> |
constexpr bool | hasAttribute (const std::string &subKey="") const |
|
template<InjectableAttribute Attribute, fixed_string key = ""> |
bool | getAttribute (const std::function< void(Attribute &)> &onFound, const std::string &subKey="") const |
|
template<InjectableAttribute Attribute, fixed_string key = ""> |
void | getAttribute (const std::function< void(Attribute &)> &onFound, const std::function< void(const std::string &)> &onNotFound, const std::string &subKey="") const |
|
void | reset () |
|
|
std::map< std::string, std::shared_ptr< void > > | attributes |
|
Definition at line 146 of file AttributeInjector.h.
◆ delAttribute()
template<InjectableAttribute Attribute,
fixed_string key = "">
constexpr bool utils::MultibleAttributeInjector::delAttribute |
( |
const std::string & |
subKey = "" | ) |
|
|
inlineconstexpr |
Definition at line 175 of file AttributeInjector.h.
175 {
176 bool deleted =
attributes.erase(
typeid(Attribute).name() + std::string(key) + subKey) > 0;
177
178 return deleted;
179 }
std::map< std::string, std::shared_ptr< void > > attributes
◆ getAttribute() [1/2]
template<InjectableAttribute Attribute,
fixed_string key = "">
void utils::MultibleAttributeInjector::getAttribute |
( |
const std::function< void(Attribute &)> & |
onFound, |
|
|
const std::function< void(const std::string &)> & |
onNotFound, |
|
|
const std::string & |
subKey = "" |
|
) |
| const |
|
inline |
Definition at line 205 of file AttributeInjector.h.
207 {
208 std::map<std::string, std::shared_ptr<void>>::const_iterator it =
209 attributes.find(
typeid(Attribute).name() + std::string(key) + subKey);
210
212 onFound(**std::static_pointer_cast<AttributeProxy<Attribute>>(it->second));
213 } else {
214 onNotFound(std::string(typeid(Attribute).name()) + std::string(key) + subKey);
215 }
216 }
Referenced by main().
◆ getAttribute() [2/2]
template<InjectableAttribute Attribute,
fixed_string key = "">
bool utils::MultibleAttributeInjector::getAttribute |
( |
const std::function< void(Attribute &)> & |
onFound, |
|
|
const std::string & |
subKey = "" |
|
) |
| const |
|
inline |
Definition at line 189 of file AttributeInjector.h.
189 {
190 bool found = false;
191
192 std::map<std::string, std::shared_ptr<void>>::const_iterator it =
193 attributes.find(
typeid(Attribute).name() + std::string(key) + subKey);
194
196 found = true;
197
198 onFound(**std::static_pointer_cast<AttributeProxy<Attribute>>(it->second));
199 }
200
201 return found;
202 }
◆ hasAttribute()
template<InjectableAttribute Attribute,
fixed_string key = "">
constexpr bool utils::MultibleAttributeInjector::hasAttribute |
( |
const std::string & |
subKey = "" | ) |
const |
|
inlineconstexpr |
◆ reset()
void utils::MultibleAttributeInjector::reset |
( |
| ) |
|
|
inline |
◆ setAttribute() [1/2]
template<InjectableAttribute Attribute,
fixed_string key = "">
constexpr bool utils::MultibleAttributeInjector::setAttribute |
( |
const Attribute && |
attribute, |
|
|
const std::string & |
subKey = "" , |
|
|
bool |
overwrite = false |
|
) |
| |
|
inlineconstexpr |
Definition at line 162 of file AttributeInjector.h.
162 {
163 bool inserted = false;
164
165 if (
attributes.find(
typeid(Attribute).name() + std::string(key) + subKey) ==
attributes.end() || overwrite) {
166 attributes[
typeid(Attribute).name() + std::string(key) + subKey] =
167 std::shared_ptr<void>(new AttributeProxy<Attribute>(attribute));
168 inserted = true;
169 }
170
171 return inserted;
172 }
◆ setAttribute() [2/2]
template<InjectableAttribute Attribute,
fixed_string key = "">
constexpr bool utils::MultibleAttributeInjector::setAttribute |
( |
const Attribute & |
attribute, |
|
|
const std::string & |
subKey = "" , |
|
|
bool |
overwrite = false |
|
) |
| |
|
inlineconstexpr |
◆ attributes
std::map<std::string, std::shared_ptr<void> > utils::MultibleAttributeInjector::attributes |
|
private |
The documentation for this class was generated from the following file: