aboutsummaryrefslogtreecommitdiffstats
path: root/al/eax/fx_slot_index.h
diff options
context:
space:
mode:
Diffstat (limited to 'al/eax/fx_slot_index.h')
-rw-r--r--al/eax/fx_slot_index.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/al/eax/fx_slot_index.h b/al/eax/fx_slot_index.h
new file mode 100644
index 00000000..63dba037
--- /dev/null
+++ b/al/eax/fx_slot_index.h
@@ -0,0 +1,41 @@
+#ifndef EAX_FX_SLOT_INDEX_INCLUDED
+#define EAX_FX_SLOT_INDEX_INCLUDED
+
+
+#include <cstddef>
+
+#include "aloptional.h"
+#include "api.h"
+
+
+using EaxFxSlotIndexValue = std::size_t;
+
+class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue>
+{
+public:
+ using al::optional<EaxFxSlotIndexValue>::optional;
+
+ EaxFxSlotIndex& operator=(const EaxFxSlotIndexValue &value) { set(value); return *this; }
+ EaxFxSlotIndex& operator=(const GUID &guid) { set(guid); return *this; }
+
+ void set(EaxFxSlotIndexValue index);
+ void set(const GUID& guid);
+
+private:
+ [[noreturn]]
+ static void fail(const char *message);
+}; // EaxFxSlotIndex
+
+inline bool operator==(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
+{
+ if(lhs.has_value() != rhs.has_value())
+ return false;
+ if(lhs.has_value())
+ return *lhs == *rhs;
+ return true;
+}
+
+inline bool operator!=(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
+{ return !(lhs == rhs); }
+
+#endif // !EAX_FX_SLOT_INDEX_INCLUDED