aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/PostBuildLint_BuildType.h
blob: c152ddfc96f2cf0586fe5fc86551d7df7c516783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#include "PostBuildLint_ConfigurationType.h"
#include "PostBuildLint_LinkageType.h"
#include <array>
#include <regex>

namespace vcpkg::PostBuildLint::BuildType
{
    enum class BackingEnum
    {
        DEBUG_STATIC = 1,
        DEBUG_DYNAMIC,
        RELEASE_STATIC,
        RELEASE_DYNAMIC
    };

    struct Type
    {
        Type() = delete;

        constexpr explicit Type(const BackingEnum backing_enum, const ConfigurationType::Type config, const LinkageType::Type linkage) :
            backing_enum(backing_enum), m_config(config), m_linkage(linkage) { }

        constexpr operator BackingEnum() const { return backing_enum; }

        const ConfigurationType::Type& config() const;
        const LinkageType::Type& linkage() const;
        const std::regex& crt_regex() const;
        const std::string& to_string() const;

    private:
        BackingEnum backing_enum;
        ConfigurationType::Type m_config;
        LinkageType::Type m_linkage;
    };

    static const std::string ENUM_NAME = "vcpkg::PostBuildLint::BuildType";

    static constexpr Type DEBUG_STATIC = Type(BackingEnum::DEBUG_STATIC, ConfigurationType::DEBUG, LinkageType::STATIC);
    static constexpr Type DEBUG_DYNAMIC = Type(BackingEnum::DEBUG_DYNAMIC, ConfigurationType::DEBUG, LinkageType::DYNAMIC);
    static constexpr Type RELEASE_STATIC = Type(BackingEnum::RELEASE_STATIC, ConfigurationType::RELEASE, LinkageType::STATIC);
    static constexpr Type RELEASE_DYNAMIC = Type(BackingEnum::RELEASE_DYNAMIC, ConfigurationType::RELEASE, LinkageType::DYNAMIC);

    static constexpr std::array<Type, 4> values = { DEBUG_STATIC, DEBUG_DYNAMIC, RELEASE_STATIC, RELEASE_DYNAMIC };

    Type value_of(const ConfigurationType::Type& config, const LinkageType::Type& linkage);
}