-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheighteen_byte_descriptor.hh
34 lines (28 loc) · 1.11 KB
/
eighteen_byte_descriptor.hh
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
// Copyright 2023 N-Nagorny
#pragma once
#include <array>
#include <cstdint>
#include <iostream>
#include <memory>
#include "dtd.hh"
#include "eighteen_byte_descriptors.hh"
namespace Edid {
#if (defined(__cplusplus) && __cplusplus >= 202002L)
template<typename T>
concept EighteenByteDescriptorInterface = std::is_base_of_v<IEighteenByteDescriptor, T>;
template<EighteenByteDescriptorInterface... Ts>
using EighteenByteDescriptorVariant = std::variant<Ts...>;
using EighteenByteDescriptor = EighteenByteDescriptorVariant<
#else
using EighteenByteDescriptor = std::variant<
#endif
DummyDescriptor, // [E-EDID] Section 3.10.3.11
DetailedTimingDescriptor, // [E-EDID] Section 3.10.2
DisplayRangeLimits, // [E-EDID] Section 3.10.3.3
AsciiString, // [E-EDID] Sections 3.10.3.1, 3.10.3.2, 3.10.3.4
EstablishedTimings3 // [E-EDID] Section 3.10.3.9
>;
static bool has_18_byte_descr_type(const EighteenByteDescriptor& descriptor, uint8_t type) {
return std::visit([type](auto&& descr){ return descr.type() == type; }, descriptor);
}
} // namespace Edid