mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 18:20:04 +00:00
Add types for audio alerts
This commit is contained in:
parent
e1ccc1ebb8
commit
9486d2364a
7 changed files with 97 additions and 1 deletions
20
wxdata/include/scwx/util/enum.hpp
Normal file
20
wxdata/include/scwx/util/enum.hpp
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
|
||||
#define SCWX_GET_ENUM(Type, FunctionName, nameMap) \
|
||||
Type FunctionName(const std::string& name) \
|
||||
{ \
|
||||
auto result = \
|
||||
std::find_if(nameMap.cbegin(), \
|
||||
nameMap.cend(), \
|
||||
[&](const std::pair<Type, std::string>& pair) -> bool \
|
||||
{ return boost::iequals(pair.second, name); }); \
|
||||
\
|
||||
if (result != nameMap.cend()) \
|
||||
{ \
|
||||
return result->first; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
return Type::Unknown; \
|
||||
} \
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue