diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-04-28 17:27:07 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-04-30 03:36:55 -0700 |
| commit | cbc52bc6a4f92ac4c5379912b09adb37a6ea1918 (patch) | |
| tree | ebd28c77d4268f6ac8fc1c0906ce2e279e530e63 /toolsrc/include/OptBool.h | |
| parent | 5419aebcfed8cf044f723e07dd785b839fd6bb5b (diff) | |
| download | vcpkg-cbc52bc6a4f92ac4c5379912b09adb37a6ea1918.tar.gz vcpkg-cbc52bc6a4f92ac4c5379912b09adb37a6ea1918.zip | |
[vcpkg] Remove OptBool in favor of Optional<bool>
Diffstat (limited to 'toolsrc/include/OptBool.h')
| -rw-r--r-- | toolsrc/include/OptBool.h | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/toolsrc/include/OptBool.h b/toolsrc/include/OptBool.h deleted file mode 100644 index 90655cb7e..000000000 --- a/toolsrc/include/OptBool.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include <map> -#include <string> - -namespace vcpkg -{ - struct OptBool final - { - enum class BackingEnum - { - UNSPECIFIED = 0, - ENABLED, - DISABLED - }; - - static OptBool parse(const std::string& s); - - template<class T> - static OptBool from_map(const std::map<T, std::string>& map, const T& key); - - constexpr OptBool() : backing_enum(BackingEnum::UNSPECIFIED) {} - constexpr explicit OptBool(BackingEnum backing_enum) : backing_enum(backing_enum) {} - constexpr operator BackingEnum() const { return backing_enum; } - - private: - BackingEnum backing_enum; - }; - - namespace OptBoolC - { - static constexpr OptBool UNSPECIFIED(OptBool::BackingEnum::UNSPECIFIED); - static constexpr OptBool ENABLED(OptBool::BackingEnum::ENABLED); - static constexpr OptBool DISABLED(OptBool::BackingEnum::DISABLED); - } - - template<class T> - OptBool OptBool::from_map(const std::map<T, std::string>& map, const T& key) - { - auto it = map.find(key); - if (it == map.cend()) - { - return OptBoolC::UNSPECIFIED; - } - - return parse(*it); - } -} |
