aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/opt_bool.h
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/include/opt_bool.h
parent5e588ddb5be9e6e27cebcc3be2e1a27f3ca83a50 (diff)
parenta9f7fc6e90feaad50c1221ef9bd56e2620302215 (diff)
downloadvcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.tar.gz
vcpkg-7ddae17e2f520e83d25f78c078bf8b8a58fff447.zip
Merge branch 'master' into master
Diffstat (limited to 'toolsrc/include/opt_bool.h')
-rw-r--r--toolsrc/include/opt_bool.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/toolsrc/include/opt_bool.h b/toolsrc/include/opt_bool.h
index 3856366c8..06642a399 100644
--- a/toolsrc/include/opt_bool.h
+++ b/toolsrc/include/opt_bool.h
@@ -1,11 +1,33 @@
#pragma once
-namespace vcpkg
+#include <string>
+#include <map>
+
+namespace vcpkg::opt_bool
{
- enum class opt_bool
+ enum class type
{
- unspecified,
- enabled,
- disabled
+ UNSPECIFIED = 0,
+ ENABLED,
+ DISABLED
};
+
+ 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);
+ }
}
+
+namespace vcpkg
+{
+ using opt_bool_t = opt_bool::type;
+} \ No newline at end of file