diff options
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); - } -} |
