cemu-vcpkg/toolsrc/src/PostBuildLint_BuildPolicies.cpp

71 lines
2.2 KiB
C++
Raw Normal View History

#include "pch.h"
#include "PostBuildLint_BuildPolicies.h"
2017-02-09 19:00:09 -08:00
#include "vcpkg_Enums.h"
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";
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";
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;
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;
default:
2017-02-09 19:00:09 -08:00
Enums::unreachable(ENUM_NAME);
}
}
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";
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";
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);
}
}
type parse(const std::string& s)
{
2017-02-07 17:02:57 -08:00
if (s == NAME_EMPTY_PACKAGE)
{
return BuildPolicies::EMPTY_PACKAGE;
}
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;
}
}