2016-09-19 11:50:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
2017-02-01 05:31:45 +08:00
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
namespace vcpkg::opt_bool
|
2016-09-19 11:50:08 +08:00
|
|
|
{
|
2017-02-01 05:31:45 +08:00
|
|
|
enum class type
|
2016-09-19 11:50:08 +08:00
|
|
|
{
|
2017-02-01 05:31:45 +08:00
|
|
|
UNSPECIFIED = 0,
|
2017-02-01 04:59:20 +08:00
|
|
|
ENABLED,
|
|
|
|
DISABLED
|
2016-09-19 11:50:08 +08:00
|
|
|
};
|
2017-02-01 05:31:45 +08:00
|
|
|
|
|
|
|
type parse(const std::string& s);
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
type from_map(const std::map<T, std::string>& map, const T& key)
|
|
|
|
{
|
|
|
|
auto it = map.find(key);
|
|
|
|
if (it == map.cend())
|
|
|
|
{
|
|
|
|
return type::UNSPECIFIED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return parse(*it);
|
|
|
|
}
|
2016-09-19 11:50:08 +08:00
|
|
|
}
|
2017-02-01 05:31:45 +08:00
|
|
|
|
|
|
|
namespace vcpkg
|
|
|
|
{
|
|
|
|
using opt_bool_t = opt_bool::type;
|
|
|
|
}
|