mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-22 20:30:04 +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
|
class Flags
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// constructors
|
||||||
VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT
|
||||||
: m_mask(0)
|
: m_mask(0)
|
||||||
{}
|
{}
|
||||||
@ -4453,6 +4454,65 @@ int main( int argc, char **argv )
|
|||||||
: m_mask(flags)
|
: 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
|
Flags<BitType> & operator=(Flags<BitType> const& rhs) VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
m_mask = rhs.m_mask;
|
m_mask = rhs.m_mask;
|
||||||
@ -4477,41 +4537,7 @@ int main( int argc, char **argv )
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
// cast operators
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT
|
explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !!m_mask;
|
return !!m_mask;
|
||||||
@ -4526,22 +4552,29 @@ int main( int argc, char **argv )
|
|||||||
MaskType m_mask;
|
MaskType m_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// relational operators
|
||||||
template <typename BitType>
|
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>
|
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>
|
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>
|
template <typename BitType>
|
||||||
@ -4555,6 +4588,25 @@ int main( int argc, char **argv )
|
|||||||
{
|
{
|
||||||
return flags != bit;
|
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"(
|
static const std::string classObjectDestroy = R"(
|
||||||
|
@ -269,6 +269,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
class Flags
|
class Flags
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
// constructors
|
||||||
VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT
|
VULKAN_HPP_CONSTEXPR Flags() VULKAN_HPP_NOEXCEPT
|
||||||
: m_mask(0)
|
: m_mask(0)
|
||||||
{}
|
{}
|
||||||
@ -285,6 +286,65 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
: m_mask(flags)
|
: 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
|
Flags<BitType> & operator=(Flags<BitType> const& rhs) VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
m_mask = rhs.m_mask;
|
m_mask = rhs.m_mask;
|
||||||
@ -309,41 +369,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
VULKAN_HPP_CONSTEXPR Flags<BitType> operator|(Flags<BitType> const& rhs) const VULKAN_HPP_NOEXCEPT
|
// cast operators
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT
|
explicit VULKAN_HPP_CONSTEXPR operator bool() const VULKAN_HPP_NOEXCEPT
|
||||||
{
|
{
|
||||||
return !!m_mask;
|
return !!m_mask;
|
||||||
@ -358,22 +384,29 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
MaskType m_mask;
|
MaskType m_mask;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// relational operators
|
||||||
template <typename BitType>
|
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>
|
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>
|
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>
|
template <typename BitType>
|
||||||
@ -388,6 +421,25 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
return flags != bit;
|
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>
|
template <typename RefType>
|
||||||
class Optional
|
class Optional
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user