forked from VATSIM-UK/uk-controller-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStandAssignmentSource.h
More file actions
66 lines (57 loc) · 1.67 KB
/
Copy pathStandAssignmentSource.h
File metadata and controls
66 lines (57 loc) · 1.67 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#pragma once
#include <string>
#include <string_view>
namespace UKControllerPlugin::Stands {
/*
Represents a stand assignment with its source (how it was assigned).
*/
struct StandAssignment
{
enum class Source
{
Unknown,
User,
ReservationAllocator,
VaaAllocator,
SystemAuto,
};
int standId;
// The source of the assignment (user, reservation_allocator, vaa_allocator, system_auto)
Source source;
[[nodiscard]] static constexpr auto ToString(Source source) -> std::string_view
{
using enum Source;
switch (source) {
case Unknown:
return "unknown";
case User:
return "user";
case ReservationAllocator:
return "reservation_allocator";
case VaaAllocator:
return "vaa_allocator";
case SystemAuto:
return "system_auto";
default:
return "unknown";
}
}
[[nodiscard]] static constexpr auto FromString(std::string_view source) -> Source
{
using enum Source;
if (source == "user") {
return User;
}
if (source == "reservation_allocator") {
return ReservationAllocator;
}
if (source == "vaa_allocator") {
return VaaAllocator;
}
if (source == "system_auto") {
return SystemAuto;
}
return Unknown;
}
};
} // namespace UKControllerPlugin::Stands