2017-01-31 17:09:48 -08:00
|
|
|
#include "pch.h"
|
2017-02-01 13:24:06 -08:00
|
|
|
#include "PostBuildLint_BuildPolicies.h"
|
2017-02-09 19:00:09 -08:00
|
|
|
#include "vcpkg_Enums.h"
|
2017-01-31 17:09:48 -08:00
|
|
|
|
|
|
|
namespace vcpkg::PostBuildLint::BuildPolicies
|
|
|
|
{
|
2017-02-09 19:00:09 -08:00
|
|
|
static const std::string NULLVALUE_STRING = Enums::nullvalue_toString(ENUM_NAME);
|
|
|
|
|
2017-02-07 17:02:57 -08:00
|
|
|
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
|
2017-01-31 17:09:48 -08:00
|
|
|
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
|
2017-03-03 19:00:48 -08:00
|
|
|
static const std::string NAME_NO_DEBUG_BINARIES = "PolicyNoDebugBinaries";
|
2017-01-31 17:09:48 -08:00
|
|
|
|
|
|
|
const std::string& type::toString() const
|
|
|
|
{
|
|
|
|
switch (this->backing_enum)
|
|
|
|
{
|
2017-02-07 17:02:57 -08:00
|
|
|
case EMPTY_PACKAGE:
|
|
|
|
return NAME_EMPTY_PACKAGE;
|
2017-01-31 17:09:48 -08:00
|
|
|
case DLLS_WITHOUT_LIBS:
|
|
|
|
return NAME_DLLS_WITHOUT_LIBS;
|
2017-03-03 19:00:48 -08:00
|
|
|
case NO_DEBUG_BINARIES:
|
|
|
|
return NAME_NO_DEBUG_BINARIES;
|
2017-02-09 19:00:09 -08:00
|
|
|
case NULLVALUE:
|
|
|
|
return NULLVALUE_STRING;
|
2017-01-31 17:09:48 -08:00
|
|
|
default:
|
2017-02-09 19:00:09 -08:00
|
|
|
Enums::unreachable(ENUM_NAME);
|
2017-01-31 17:09:48 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::string& type::cmake_variable() const
|
|
|
|
{
|
2017-02-07 17:02:57 -08:00
|
|
|
static const std::string CMAKE_VARIABLE_EMPTY_PACKAGE = "VCPKG_POLICY_EMPTY_PACKAGE";
|
2017-01-31 17:09:48 -08:00
|
|
|
static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
|
2017-03-03 19:00:48 -08:00
|
|
|
static const std::string CMAKE_VARIABLE_NO_DEBUG_BINARIES = "VCPKG_POLICY_NO_DEBUG_BINARIES";
|
2017-01-31 17:09:48 -08:00
|
|
|
|
|
|
|
switch (this->backing_enum)
|
|
|
|
{
|
2017-02-07 17:02:57 -08:00
|
|
|
case EMPTY_PACKAGE:
|
|
|
|
return CMAKE_VARIABLE_EMPTY_PACKAGE;
|
2017-01-31 18:55:14 -08:00
|
|
|
case DLLS_WITHOUT_LIBS:
|
|
|
|
return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS;
|
2017-03-03 19:00:48 -08:00
|
|
|
case NO_DEBUG_BINARIES:
|
|
|
|
return CMAKE_VARIABLE_NO_DEBUG_BINARIES;
|
2017-02-09 19:00:09 -08:00
|
|
|
case NULLVALUE:
|
|
|
|
Enums::nullvalue_used(ENUM_NAME);
|
2017-01-31 18:55:14 -08:00
|
|
|
default:
|
2017-02-09 19:00:09 -08:00
|
|
|
Enums::unreachable(ENUM_NAME);
|
2017-01-31 17:09:48 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type parse(const std::string& s)
|
|
|
|
{
|
2017-02-07 17:02:57 -08:00
|
|
|
if (s == NAME_EMPTY_PACKAGE)
|
|
|
|
{
|
|
|
|
return BuildPolicies::EMPTY_PACKAGE;
|
|
|
|
}
|
|
|
|
|
2017-01-31 17:09:48 -08:00
|
|
|
if (s == NAME_DLLS_WITHOUT_LIBS)
|
|
|
|
{
|
|
|
|
return BuildPolicies::DLLS_WITHOUT_LIBS;
|
|
|
|
}
|
|
|
|
|
2017-03-03 19:00:48 -08:00
|
|
|
if (s == NAME_NO_DEBUG_BINARIES)
|
|
|
|
{
|
|
|
|
return BuildPolicies::NO_DEBUG_BINARIES;
|
|
|
|
}
|
|
|
|
|
2017-02-09 19:00:09 -08:00
|
|
|
return BuildPolicies::NULLVALUE;
|
2017-01-31 17:09:48 -08:00
|
|
|
}
|
|
|
|
}
|