mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
29 lines
546 B
C++
29 lines
546 B
C++
#include <algorithm>
|
|
|
|
#include <Config/Parser.h>
|
|
#include <Config/EnumSetting.h>
|
|
|
|
namespace
|
|
{
|
|
std::map<std::string, unsigned> createMapping(const std::vector<std::string>& enumNames)
|
|
{
|
|
std::map<std::string, unsigned> mapping;
|
|
unsigned i = 0;
|
|
for (const auto& name : enumNames)
|
|
{
|
|
|
|
mapping[name] = i;
|
|
++i;
|
|
}
|
|
return mapping;
|
|
}
|
|
}
|
|
|
|
namespace Config
|
|
{
|
|
EnumSetting::EnumSetting(const std::string& name, unsigned default, const std::vector<std::string>& enumNames)
|
|
: MappedSetting(name, default, createMapping(enumNames))
|
|
{
|
|
}
|
|
}
|