Rework ConfigurationType enum
MODIFY
include/PostBuildLint_BuildType.h
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 };
}}

MODIFY
include/PostBuildLint_ConfigurationType.h
include/PostBuildLint_ConfigurationType.h
#pragma once
#include <string>
-namespace vcpkg::PostBuildLint::ConfigurationType
+namespace vcpkg::PostBuildLint
+{
+ struct ConfigurationType
{
enum class BackingEnum
{
@@ -11,10 +13,8 @@ namespace vcpkg::PostBuildLint::ConfigurationType
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 };
+ }
}

MODIFY
src/PostBuildLint.cpp
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:

MODIFY
src/PostBuildLint_BuildType.cpp
src/PostBuildLint_BuildType.cpp
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;
}

MODIFY
src/PostBuildLint_ConfigurationType.cpp
src/PostBuildLint_ConfigurationType.cpp
#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);

Rework ConfigurationType enum