From 1c1423014f5aab77339ebcb261e1d33e3106ec5d Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Mon, 3 Apr 2017 14:43:44 -0700 Subject: opt_bool->OptBool --- toolsrc/include/OptBool.h | 33 +++++++++++++++++++++++++++++++ toolsrc/include/PostBuildLint_BuildInfo.h | 4 ++-- toolsrc/include/opt_bool.h | 33 ------------------------------- toolsrc/include/vcpkg_cmd_arguments.h | 8 ++++---- 4 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 toolsrc/include/OptBool.h delete mode 100644 toolsrc/include/opt_bool.h (limited to 'toolsrc/include') diff --git a/toolsrc/include/OptBool.h b/toolsrc/include/OptBool.h new file mode 100644 index 000000000..4098e6f03 --- /dev/null +++ b/toolsrc/include/OptBool.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +namespace vcpkg::OptBool +{ + enum class Type + { + UNSPECIFIED = 0, + ENABLED, + DISABLED + }; + + Type parse(const std::string& s); + + template + Type from_map(const std::map& map, const T& key) + { + auto it = map.find(key); + if (it == map.cend()) + { + return Type::UNSPECIFIED; + } + + return parse(*it); + } +} + +namespace vcpkg +{ + using OptBoolT = OptBool::Type; +} \ No newline at end of file diff --git a/toolsrc/include/PostBuildLint_BuildInfo.h b/toolsrc/include/PostBuildLint_BuildInfo.h index bac024e01..cbc944488 100644 --- a/toolsrc/include/PostBuildLint_BuildInfo.h +++ b/toolsrc/include/PostBuildLint_BuildInfo.h @@ -2,7 +2,7 @@ #include "filesystem_fs.h" #include "PostBuildLint_BuildPolicies.h" -#include "opt_bool.h" +#include "OptBool.h" #include "PostBuildLint_LinkageType.h" namespace vcpkg::PostBuildLint @@ -14,7 +14,7 @@ namespace vcpkg::PostBuildLint LinkageType::type crt_linkage; LinkageType::type library_linkage; - std::map policies; + std::map policies; }; BuildInfo read_build_info(const fs::path& filepath); diff --git a/toolsrc/include/opt_bool.h b/toolsrc/include/opt_bool.h deleted file mode 100644 index 06642a399..000000000 --- a/toolsrc/include/opt_bool.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include - -namespace vcpkg::opt_bool -{ - enum class type - { - UNSPECIFIED = 0, - ENABLED, - DISABLED - }; - - type parse(const std::string& s); - - template - type from_map(const std::map& 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 diff --git a/toolsrc/include/vcpkg_cmd_arguments.h b/toolsrc/include/vcpkg_cmd_arguments.h index 91f7de8ac..6f06ad98d 100644 --- a/toolsrc/include/vcpkg_cmd_arguments.h +++ b/toolsrc/include/vcpkg_cmd_arguments.h @@ -3,7 +3,7 @@ #include #include #include -#include "opt_bool.h" +#include "OptBool.h" namespace vcpkg { @@ -14,9 +14,9 @@ namespace vcpkg std::unique_ptr vcpkg_root_dir; std::unique_ptr target_triplet; - opt_bool_t debug = opt_bool_t::UNSPECIFIED; - opt_bool_t sendmetrics = opt_bool_t::UNSPECIFIED; - opt_bool_t printmetrics = opt_bool_t::UNSPECIFIED; + OptBoolT debug = OptBoolT::UNSPECIFIED; + OptBoolT sendmetrics = OptBoolT::UNSPECIFIED; + OptBoolT printmetrics = OptBoolT::UNSPECIFIED; std::string command; std::vector command_arguments; -- cgit v1.2.3