🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. #ifndef EAX_FX_SLOT_INDEX_INCLUDED
  2. #define EAX_FX_SLOT_INDEX_INCLUDED
  3. #include <cstddef>
  4. #include "aloptional.h"
  5. #include "eax_api.h"
  6. using EaxFxSlotIndexValue = std::size_t;
  7. class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue>
  8. {
  9. public:
  10. using al::optional<EaxFxSlotIndexValue>::optional;
  11. EaxFxSlotIndex& operator=(const EaxFxSlotIndexValue &value) { set(value); return *this; }
  12. EaxFxSlotIndex& operator=(const GUID &guid) { set(guid); return *this; }
  13. void set(EaxFxSlotIndexValue index);
  14. void set(const GUID& guid);
  15. private:
  16. [[noreturn]]
  17. static void fail(const char *message);
  18. }; // EaxFxSlotIndex
  19. inline bool operator==(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
  20. {
  21. if(lhs.has_value() != rhs.has_value())
  22. return false;
  23. if(lhs.has_value())
  24. return *lhs == *rhs;
  25. return true;
  26. }
  27. inline bool operator!=(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
  28. { return !(lhs == rhs); }
  29. #endif // !EAX_FX_SLOT_INDEX_INCLUDED