aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/opt_bool.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-02-08 15:12:28 -0800
committerGitHub <noreply@github.com>2017-02-08 15:12:28 -0800
commit7ddae17e2f520e83d25f78c078bf8b8a58fff447 (patch)
tree87e2fc5c57a685367ec051b1efbdeb5d3ab43f4d /toolsrc/src/opt_bool.cpp
parent5e588ddb5be9e6e27cebcc3be2e1a27f3ca83a50 (diff)
parenta9f7fc6e90feaad50c1221ef9bd56e2620302215 (diff)
downloadvcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.tar.gz
vcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.zip
Merge branch 'master' into master
Diffstat (limited to 'toolsrc/src/opt_bool.cpp')
-rw-r--r--toolsrc/src/opt_bool.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/toolsrc/src/opt_bool.cpp b/toolsrc/src/opt_bool.cpp
new file mode 100644
index 000000000..324936fb4
--- /dev/null
+++ b/toolsrc/src/opt_bool.cpp
@@ -0,0 +1,29 @@
+#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;
+ }
+
+ Checks::exit_with_message("Could not convert string [%s] to opt_bool", s);
+ }
+}