2017-01-31 13:31:45 -08:00
|
|
|
#include "pch.h"
|
|
|
|
#include "opt_bool.h"
|
|
|
|
#include "vcpkg_Checks.h"
|
|
|
|
|
|
|
|
namespace vcpkg::opt_bool
|
|
|
|
{
|
|
|
|
static const std::string UNSPECIFIED_NAME = "unspecified";
|
|
|
|
static const std::string ENABLED_NAME = "enabled";
|
|
|
|
static const std::string DISABLED_NAME = "disabled";
|
|
|
|
type parse(const std::string& s)
|
|
|
|
{
|
|
|
|
if (s == UNSPECIFIED_NAME)
|
|
|
|
{
|
|
|
|
return opt_bool_t::UNSPECIFIED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s == ENABLED_NAME)
|
|
|
|
{
|
|
|
|
return opt_bool_t::ENABLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s == DISABLED_NAME)
|
|
|
|
{
|
|
|
|
return opt_bool_t::DISABLED;
|
|
|
|
}
|
|
|
|
|
2017-03-13 17:38:04 -07:00
|
|
|
Checks::exit_with_message(VCPKG_LINE_INFO, "Could not convert string [%s] to opt_bool", s);
|
2017-01-31 13:31:45 -08:00
|
|
|
}
|
|
|
|
}
|