mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Completed set of operators on Flags (#475)
This commit is contained in:
parent
55517484be
commit
1911d18790
@ -4437,6 +4437,7 @@ int main( int argc, char **argv )
|
||||
class Flags
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT
|
||||
: m_mask(0)
|
||||
{}
|
||||
@ -4453,6 +4454,65 @@ int main( int argc, char **argv )
|
||||
: m_mask(flags)
|
||||
{}
|
||||
|
||||
// relational operators
|
||||
VULKAN_HPP_CONSTEXPR bool operator<(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask < rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator<=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask <= rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator>(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask > rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator>=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask >= rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator==(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask == rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator!=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask != rhs.m_mask;
|
||||
}
|
||||
|
||||
// logical operator
|
||||
VULKAN_HPP_CONSTEXPR bool operator!() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !m_mask;
|
||||
}
|
||||
|
||||
// bitwise operators
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask & rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask | rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator~() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ FlagTraits<BitType>::allFlags);
|
||||
}
|
||||
|
||||
// assignment operators
|
||||
Flags<BitType> & operator=(Flags<BitType> const& rhs) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
m_mask = rhs.m_mask;
|
||||
@ -4477,41 +4537,7 @@ int main( int argc, char **argv )
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask | rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask & rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator!() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator~() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ FlagTraits<BitType>::allFlags);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator==(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask == rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator!=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask != rhs.m_mask;
|
||||
}
|
||||
|
||||
// cast operators
|
||||
explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !!m_mask;
|
||||
@ -4526,22 +4552,29 @@ int main( int argc, char **argv )
|
||||
MaskType m_mask;
|
||||
};
|
||||
|
||||
// relational operators
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool operator<(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags | bit;
|
||||
return flags > bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool operator<=(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags & bit;
|
||||
return flags >= bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool operator>(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags ^ bit;
|
||||
return flags < bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator>=(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags <= bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
@ -4555,6 +4588,25 @@ int main( int argc, char **argv )
|
||||
{
|
||||
return flags != bit;
|
||||
}
|
||||
|
||||
// bitwise operators
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags & bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags | bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags ^ bit;
|
||||
}
|
||||
)";
|
||||
|
||||
static const std::string classObjectDestroy = R"(
|
||||
|
@ -269,6 +269,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
class Flags
|
||||
{
|
||||
public:
|
||||
// constructors
|
||||
VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT
|
||||
: m_mask(0)
|
||||
{}
|
||||
@ -285,6 +286,65 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
: m_mask(flags)
|
||||
{}
|
||||
|
||||
// relational operators
|
||||
VULKAN_HPP_CONSTEXPR bool operator<(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask < rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator<=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask <= rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator>(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask > rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator>=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask >= rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator==(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask == rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator!=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask != rhs.m_mask;
|
||||
}
|
||||
|
||||
// logical operator
|
||||
VULKAN_HPP_CONSTEXPR bool operator!() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !m_mask;
|
||||
}
|
||||
|
||||
// bitwise operators
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask & rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask | rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator~() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ FlagTraits<BitType>::allFlags);
|
||||
}
|
||||
|
||||
// assignment operators
|
||||
Flags<BitType> & operator=(Flags<BitType> const& rhs) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
m_mask = rhs.m_mask;
|
||||
@ -309,41 +369,7 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
return *this;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask | rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask & rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ rhs.m_mask);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator!() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator~() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return Flags<BitType>(m_mask ^ FlagTraits<BitType>::allFlags);
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator==(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask == rhs.m_mask;
|
||||
}
|
||||
|
||||
VULKAN_HPP_CONSTEXPR bool operator!=(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return m_mask != rhs.m_mask;
|
||||
}
|
||||
|
||||
// cast operators
|
||||
explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return !!m_mask;
|
||||
@ -358,22 +384,29 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
MaskType m_mask;
|
||||
};
|
||||
|
||||
// relational operators
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool operator<(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags | bit;
|
||||
return flags > bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool operator<=(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags & bit;
|
||||
return flags >= bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
VULKAN_HPP_CONSTEXPR bool operator>(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags ^ bit;
|
||||
return flags < bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR bool operator>=(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags <= bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
@ -388,6 +421,25 @@ namespace VULKAN_HPP_NAMESPACE
|
||||
return flags != bit;
|
||||
}
|
||||
|
||||
// bitwise operators
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator&(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags & bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags | bit;
|
||||
}
|
||||
|
||||
template <typename BitType>
|
||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator^(BitType bit, Flags<BitType> const& flags) VULKAN_HPP_NOEXCEPT
|
||||
{
|
||||
return flags ^ bit;
|
||||
}
|
||||
|
||||
template <typename RefType>
|
||||
class Optional
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user