Avara3D 0.2.0
C++ API reference
Environment.h
1//
2// Environment.h
3// avara3d
4//
5// Created by Morgan Davis on 8/19/26.
6// Copyright © 2026 Morgan K Davis. All rights reserved.
7//
8
9#ifndef AVARA3D_ENVIRONMENT_H
10#define AVARA3D_ENVIRONMENT_H
11
12#include <cstdint>
13
14#include "a3d/util/Bitmask.h"
15
16namespace a3d {
17
18 // [Public Types]
19
21 enum class Platform : std::uint8_t {
22 None = 0,
23
24 Linux = 1 << 0,
25 macOS = 1 << 1,
26 Windows = 1 << 2,
27 Android = 1 << 3,
28 iOS = 1 << 4,
29 Web = 1 << 5,
30
31 Desktop = (1 << 0) | (1 << 1) | (1 << 2),
32 Mobile = (1 << 3) | (1 << 4)
33 };
34
35 namespace env {
36
37 // [Public Constants]
38
40#if defined(A3D_LINUX)
41 inline constexpr Platform platform = Platform::Linux;
42#elif defined(A3D_MACOS)
43 inline constexpr Platform platform = Platform::macOS;
44#elif defined(A3D_WINDOWS)
45 inline constexpr Platform platform = Platform::Windows;
46#elif defined(A3D_ANDROID)
47 inline constexpr Platform platform = Platform::Android;
48#elif defined(A3D_IOS)
49 inline constexpr Platform platform = Platform::iOS;
50#elif defined(A3D_WEB)
51 inline constexpr Platform platform = Platform::Web;
52#else
53 #error Unsupported platform.
54#endif
55
56 // [Public Functions]
57
59 constexpr bool is(Platform platforms) noexcept {
60
61 return util::bitmask::any(platform, platforms);
62 }
63
64 }
65
66 namespace util::bitmask {
67
68 // [Internal Types]
69
70 template<>
71 struct enable_ops<Platform> : std::true_type {};
72
73 }
74
75}
76
77#endif // AVARA3D_ENVIRONMENT_H