aboutsummaryrefslogtreecommitdiff
path: root/toolsrc
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-04-25 17:39:59 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-04-25 17:56:19 -0700
commitef0bdb00e4f671ea3c5d1bf096d230b57b526d96 (patch)
tree9431d190cd14747058b2b24897301e6124dc0ca2 /toolsrc
parentd3d00b33dd524815b47f1bc6e6f8080dc7054d29 (diff)
downloadvcpkg-ef0bdb00e4f671ea3c5d1bf096d230b57b526d96.tar.gz
vcpkg-ef0bdb00e4f671ea3c5d1bf096d230b57b526d96.zip
Rework ConfigurationType enum
Diffstat (limited to 'toolsrc')
-rw-r--r--toolsrc/include/PostBuildLint_BuildType.h16
-rw-r--r--toolsrc/include/PostBuildLint_ConfigurationType.h33
-rw-r--r--toolsrc/src/PostBuildLint.cpp4
-rw-r--r--toolsrc/src/PostBuildLint_BuildType.cpp12
-rw-r--r--toolsrc/src/PostBuildLint_ConfigurationType.cpp12
5 files changed, 40 insertions, 37 deletions
diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/PostBuildLint_BuildType.h
index a086c8f03..55a5878a9 100644
--- a/toolsrc/include/PostBuildLint_BuildType.h
+++ b/toolsrc/include/PostBuildLint_BuildType.h
@@ -16,11 +16,11 @@ namespace vcpkg::PostBuildLint
RELEASE_DYNAMIC
};
- static BuildType value_of(const ConfigurationType::Type& config, const LinkageType& linkage);
+ static BuildType value_of(const ConfigurationType& config, const LinkageType& linkage);
BuildType() = delete;
- constexpr explicit BuildType(const BackingEnum backing_enum, const ConfigurationType::Type config, const LinkageType linkage)
+ constexpr explicit BuildType(const BackingEnum backing_enum, const ConfigurationType config, const LinkageType linkage)
:
backing_enum(backing_enum)
, m_config(config)
@@ -28,14 +28,14 @@ namespace vcpkg::PostBuildLint
constexpr operator BackingEnum() const { return backing_enum; }
- const ConfigurationType::Type& config() const;
+ const ConfigurationType& config() const;
const LinkageType& linkage() const;
const std::regex& crt_regex() const;
const std::string& to_string() const;
private:
BackingEnum backing_enum;
- ConfigurationType::Type m_config;
+ ConfigurationType m_config;
LinkageType m_linkage;
};
@@ -43,10 +43,10 @@ namespace vcpkg::PostBuildLint
{
static constexpr const char* ENUM_NAME = "vcpkg::PostBuildLint::BuildType";
- static constexpr BuildType DEBUG_STATIC = BuildType(BuildType::BackingEnum::DEBUG_STATIC, ConfigurationType::DEBUG, LinkageTypeC::STATIC);
- static constexpr BuildType DEBUG_DYNAMIC = BuildType(BuildType::BackingEnum::DEBUG_DYNAMIC, ConfigurationType::DEBUG, LinkageTypeC::DYNAMIC);
- static constexpr BuildType RELEASE_STATIC = BuildType(BuildType::BackingEnum::RELEASE_STATIC, ConfigurationType::RELEASE, LinkageTypeC::STATIC);
- static constexpr BuildType RELEASE_DYNAMIC = BuildType(BuildType::BackingEnum::RELEASE_DYNAMIC, ConfigurationType::RELEASE, LinkageTypeC::DYNAMIC);
+ static constexpr BuildType DEBUG_STATIC = BuildType(BuildType::BackingEnum::DEBUG_STATIC, ConfigurationTypeC::DEBUG, LinkageTypeC::STATIC);
+ static constexpr BuildType DEBUG_DYNAMIC = BuildType(BuildType::BackingEnum::DEBUG_DYNAMIC, ConfigurationTypeC::DEBUG, LinkageTypeC::DYNAMIC);
+ static constexpr BuildType RELEASE_STATIC = BuildType(BuildType::BackingEnum::RELEASE_STATIC, ConfigurationTypeC::RELEASE, LinkageTypeC::STATIC);
+ static constexpr BuildType RELEASE_DYNAMIC = BuildType(BuildType::BackingEnum::RELEASE_DYNAMIC, ConfigurationTypeC::RELEASE, LinkageTypeC::DYNAMIC);
static constexpr std::array<BuildType, 4> VALUES = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC };
}}
diff --git a/toolsrc/include/PostBuildLint_ConfigurationType.h b/toolsrc/include/PostBuildLint_ConfigurationType.h
index 1ce63690f..710547b85 100644
--- a/toolsrc/include/PostBuildLint_ConfigurationType.h
+++ b/toolsrc/include/PostBuildLint_ConfigurationType.h
@@ -2,19 +2,19 @@
#pragma once
#include <string>
-namespace vcpkg::PostBuildLint::ConfigurationType
+namespace vcpkg::PostBuildLint
{
- enum class BackingEnum
+ struct ConfigurationType
{
- NULLVALUE = 0,
- DEBUG = 1,
- RELEASE = 2
- };
+ enum class BackingEnum
+ {
+ NULLVALUE = 0,
+ DEBUG = 1,
+ RELEASE = 2
+ };
- struct Type
- {
- constexpr Type() : backing_enum(BackingEnum::NULLVALUE) {}
- constexpr explicit Type(BackingEnum backing_enum) : backing_enum(backing_enum) { }
+ constexpr ConfigurationType() : backing_enum(BackingEnum::NULLVALUE) {}
+ constexpr explicit ConfigurationType(BackingEnum backing_enum) : backing_enum(backing_enum) { }
constexpr operator BackingEnum() const { return backing_enum; }
const std::string& to_string() const;
@@ -23,11 +23,14 @@ namespace vcpkg::PostBuildLint::ConfigurationType
BackingEnum backing_enum;
};
- static const std::string ENUM_NAME = "vcpkg::PostBuildLint::ConfigurationType";
+ namespace ConfigurationTypeC
+ {
+ static constexpr const char* ENUM_NAME = "vcpkg::PostBuildLint::ConfigurationType";
- static constexpr Type NULLVALUE(BackingEnum::NULLVALUE);
- static constexpr Type DEBUG(BackingEnum::DEBUG);
- static constexpr Type RELEASE(BackingEnum::RELEASE);
+ static constexpr ConfigurationType NULLVALUE(ConfigurationType::BackingEnum::NULLVALUE);
+ static constexpr ConfigurationType DEBUG(ConfigurationType::BackingEnum::DEBUG);
+ static constexpr ConfigurationType RELEASE(ConfigurationType::BackingEnum::RELEASE);
- static constexpr std::array<Type, 2> values = { DEBUG, RELEASE };
+ static constexpr std::array<ConfigurationType, 2> VALUES = { DEBUG, RELEASE };
+ }
}
diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp
index b11793f57..f1e1dcd17 100644
--- a/toolsrc/src/PostBuildLint.cpp
+++ b/toolsrc/src/PostBuildLint.cpp
@@ -723,9 +723,9 @@ namespace vcpkg::PostBuildLint
if (!contains_and_enabled(build_info.policies, BuildPoliciesC::ONLY_RELEASE_CRT))
{
- error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::DEBUG, build_info.crt_linkage), debug_libs, toolset.dumpbin);
+ error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationTypeC::DEBUG, build_info.crt_linkage), debug_libs, toolset.dumpbin);
}
- error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationType::RELEASE, build_info.crt_linkage), release_libs, toolset.dumpbin);
+ error_count += check_crt_linkage_of_libs(BuildType::value_of(ConfigurationTypeC::RELEASE, build_info.crt_linkage), release_libs, toolset.dumpbin);
break;
}
case LinkageType::BackingEnum::NULLVALUE:
diff --git a/toolsrc/src/PostBuildLint_BuildType.cpp b/toolsrc/src/PostBuildLint_BuildType.cpp
index 160d371f7..651e95836 100644
--- a/toolsrc/src/PostBuildLint_BuildType.cpp
+++ b/toolsrc/src/PostBuildLint_BuildType.cpp
@@ -4,24 +4,24 @@
namespace vcpkg::PostBuildLint
{
- BuildType BuildType::value_of(const ConfigurationType::Type& config, const LinkageType& linkage)
+ BuildType BuildType::value_of(const ConfigurationType& config, const LinkageType& linkage)
{
- if (config == ConfigurationType::DEBUG && linkage == LinkageTypeC::STATIC)
+ if (config == ConfigurationTypeC::DEBUG && linkage == LinkageTypeC::STATIC)
{
return BuildTypeC::DEBUG_STATIC;
}
- if (config == ConfigurationType::DEBUG && linkage == LinkageTypeC::DYNAMIC)
+ if (config == ConfigurationTypeC::DEBUG && linkage == LinkageTypeC::DYNAMIC)
{
return BuildTypeC::DEBUG_DYNAMIC;
}
- if (config == ConfigurationType::RELEASE && linkage == LinkageTypeC::STATIC)
+ if (config == ConfigurationTypeC::RELEASE && linkage == LinkageTypeC::STATIC)
{
return BuildTypeC::RELEASE_STATIC;
}
- if (config == ConfigurationType::RELEASE && linkage == LinkageTypeC::DYNAMIC)
+ if (config == ConfigurationTypeC::RELEASE && linkage == LinkageTypeC::DYNAMIC)
{
return BuildTypeC::RELEASE_DYNAMIC;
}
@@ -29,7 +29,7 @@ namespace vcpkg::PostBuildLint
Checks::unreachable(VCPKG_LINE_INFO);
}
- const ConfigurationType::Type& BuildType::config() const
+ const ConfigurationType& BuildType::config() const
{
return this->m_config;
}
diff --git a/toolsrc/src/PostBuildLint_ConfigurationType.cpp b/toolsrc/src/PostBuildLint_ConfigurationType.cpp
index e61415499..1acfb3cf9 100644
--- a/toolsrc/src/PostBuildLint_ConfigurationType.cpp
+++ b/toolsrc/src/PostBuildLint_ConfigurationType.cpp
@@ -3,22 +3,22 @@
#include "vcpkg_Enums.h"
#include "PackageSpec.h"
-namespace vcpkg::PostBuildLint::ConfigurationType
+namespace vcpkg::PostBuildLint
{
- static const std::string NULLVALUE_STRING = Enums::nullvalue_to_string(ENUM_NAME);
+ static const std::string NULLVALUE_STRING = Enums::nullvalue_to_string(ConfigurationTypeC::ENUM_NAME);
static const std::string NAME_DEBUG = "Debug";
static const std::string NAME_RELEASE = "Release";
- const std::string& Type::to_string() const
+ const std::string& ConfigurationType::to_string() const
{
switch (this->backing_enum)
{
- case ConfigurationType::DEBUG:
+ case ConfigurationTypeC::DEBUG:
return NAME_DEBUG;
- case ConfigurationType::RELEASE:
+ case ConfigurationTypeC::RELEASE:
return NAME_RELEASE;
- case ConfigurationType::NULLVALUE:
+ case ConfigurationTypeC::NULLVALUE:
return NULLVALUE_STRING;
default:
Checks::unreachable(VCPKG_LINE_INFO);