]> git.tdb.fi Git - ext/openal.git/blob - al/eax/fx_slot_index.h
Import OpenAL Soft 1.23.1 sources
[ext/openal.git] / al / eax / fx_slot_index.h
1 #ifndef EAX_FX_SLOT_INDEX_INCLUDED
2 #define EAX_FX_SLOT_INDEX_INCLUDED
3
4
5 #include <cstddef>
6
7 #include "aloptional.h"
8 #include "api.h"
9
10
11 using EaxFxSlotIndexValue = std::size_t;
12
13 class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue>
14 {
15 public:
16     using al::optional<EaxFxSlotIndexValue>::optional;
17
18     EaxFxSlotIndex& operator=(const EaxFxSlotIndexValue &value) { set(value); return *this; }
19     EaxFxSlotIndex& operator=(const GUID &guid) { set(guid); return *this; }
20
21     void set(EaxFxSlotIndexValue index);
22     void set(const GUID& guid);
23
24 private:
25     [[noreturn]]
26     static void fail(const char *message);
27 }; // EaxFxSlotIndex
28
29 inline bool operator==(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
30 {
31     if(lhs.has_value() != rhs.has_value())
32         return false;
33     if(lhs.has_value())
34         return *lhs == *rhs;
35     return true;
36 }
37
38 inline bool operator!=(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
39 { return !(lhs == rhs); }
40
41 #endif // !EAX_FX_SLOT_INDEX_INCLUDED