2017-02-01 05:31:45 +08:00
|
|
|
#include "pch.h"
|
2017-04-04 05:43:44 +08:00
|
|
|
#include "OptBool.h"
|
2017-02-01 05:31:45 +08:00
|
|
|
#include "vcpkg_Checks.h"
|
|
|
|
|
2017-04-04 05:43:44 +08:00
|
|
|
namespace vcpkg::OptBool
|
2017-02-01 05:31:45 +08:00
|
|
|
{
|
|
|
|
static const std::string UNSPECIFIED_NAME = "unspecified";
|
|
|
|
static const std::string ENABLED_NAME = "enabled";
|
|
|
|
static const std::string DISABLED_NAME = "disabled";
|
2017-04-04 05:43:44 +08:00
|
|
|
Type parse(const std::string& s)
|
2017-02-01 05:31:45 +08:00
|
|
|
{
|
|
|
|
if (s == UNSPECIFIED_NAME)
|
|
|
|
{
|
2017-04-04 05:43:44 +08:00
|
|
|
return OptBoolT::UNSPECIFIED;
|
2017-02-01 05:31:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s == ENABLED_NAME)
|
|
|
|
{
|
2017-04-04 05:43:44 +08:00
|
|
|
return OptBoolT::ENABLED;
|
2017-02-01 05:31:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (s == DISABLED_NAME)
|
|
|
|
{
|
2017-04-04 05:43:44 +08:00
|
|
|
return OptBoolT::DISABLED;
|
2017-02-01 05:31:45 +08:00
|
|
|
}
|
|
|
|
|
2017-04-04 05:43:44 +08:00
|
|
|
Checks::exit_with_message(VCPKG_LINE_INFO, "Could not convert string [%s] to OptBool", s);
|
2017-02-01 05:31:45 +08:00
|
|
|
}
|
|
|
|
}
|