mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-12-29 11:01:23 +00:00
5a3954ae0e
Fixes several files incorrectly stated a different license from the actual project, as well as the copyright headers included in all files. This change has no effect on the licensing terms, it should clear up a bit of confusion by contributors. Plus the files get a bit smaller, and we have less duplicated information across the entire project. Overall the project is GPLv2 if not built with Qt, and GPLv3 if it is built with Qt. There are no parts licensed under a different license, all have been adapted from other compatible licenses into GPLv2 or GPLv3.
55 lines
1.8 KiB
C++
55 lines
1.8 KiB
C++
// AUTOGENERATED COPYRIGHT HEADER START
|
|
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
|
// AUTOGENERATED COPYRIGHT HEADER END
|
|
|
|
#pragma once
|
|
#include "warning-disable.hpp"
|
|
#include <cstddef>
|
|
#include <type_traits>
|
|
#include "warning-enable.hpp"
|
|
|
|
template<typename Enum>
|
|
struct enable_bitmask_operators {
|
|
static const bool enable = false;
|
|
};
|
|
|
|
template<typename Enum>
|
|
typename std::enable_if<enable_bitmask_operators<Enum>::enable, Enum>::type operator|(Enum lhs, Enum rhs)
|
|
{
|
|
using underlying = typename std::underlying_type<Enum>::type;
|
|
return static_cast<Enum>(static_cast<underlying>(lhs) | static_cast<underlying>(rhs));
|
|
}
|
|
|
|
template<typename Enum>
|
|
typename std::enable_if<enable_bitmask_operators<Enum>::enable, Enum>::type operator&(Enum lhs, Enum rhs)
|
|
{
|
|
using underlying = typename std::underlying_type<Enum>::type;
|
|
return static_cast<Enum>(static_cast<underlying>(lhs) & static_cast<underlying>(rhs));
|
|
}
|
|
|
|
template<typename Enum>
|
|
typename std::enable_if<enable_bitmask_operators<Enum>::enable, bool>::type any(Enum lhs)
|
|
{
|
|
using underlying = typename std::underlying_type<Enum>::type;
|
|
return static_cast<underlying>(lhs) != static_cast<underlying>(0);
|
|
}
|
|
|
|
template<typename Enum>
|
|
typename std::enable_if<enable_bitmask_operators<Enum>::enable, bool>::type exact(Enum lhs, Enum rhs)
|
|
{
|
|
using underlying = typename std::underlying_type<Enum>::type;
|
|
return static_cast<underlying>(lhs) == static_cast<underlying>(rhs);
|
|
}
|
|
|
|
template<typename Enum>
|
|
typename std::enable_if<enable_bitmask_operators<Enum>::enable, bool>::type has(Enum lhs, Enum rhs)
|
|
{
|
|
using underlying = typename std::underlying_type<Enum>::type;
|
|
return (lhs & rhs) == rhs;
|
|
}
|
|
|
|
#define P_ENABLE_BITMASK_OPERATORS(x) \
|
|
template<> \
|
|
struct enable_bitmask_operators<x> { \
|
|
static const bool enable = true; \
|
|
};
|