Wt  3.7.1
Public Member Functions | List of all members
Wt::WFlags< EnumType > Class Template Reference

Utility class for type-safe combinations of enumeration flags. More...

#include <Wt/WFlags>

Public Member Functions

 WFlags (Zero zero=0)
 Default constructor.
 
 WFlags (EnumType flag)
 Construct from a single enum value.
 
 WFlags (const WFlags< EnumType > &other)
 Copy constructor.
 
WFlags< EnumType > & operator= (const WFlags< EnumType > &other)
 Assignment operator.
 
WFlags< EnumType > & operator= (const EnumType other)
 Assignment operator.
 
bool testFlag (EnumType flag) const
 Returns whether a flag is set.
 
WFlags< EnumType > & clear (EnumType value)
 Clears a flag.
 
 operator EnumType () const
 Cast to the enum type. More...
 
bool operator! () const
 Negation operator. More...
 
WFlags< EnumType > operator & (EnumType mask) const
 Bitwise AND operator. More...
 
WFlags< EnumType > operator & (MaskType mask) const
 Bitwise AND operator. More...
 
WFlags< EnumType > & operator &= (EnumType mask)
 Modifying bitwise AND operator. More...
 
WFlags< EnumType > & operator &= (MaskType mask)
 Modifying bitwise AND operator. More...
 
WFlags< EnumType > operator^ (WFlags< EnumType > other) const
 Bitwise XOR operator. More...
 
WFlags< EnumType > operator^ (EnumType other) const
 Bitwise XOR operator. More...
 
WFlags< EnumType > & operator^= (WFlags< EnumType > other)
 Modifying bitwise XOR operator. More...
 
WFlags< EnumType > & operator^= (EnumType other)
 Modifying bitwise XOR operator. More...
 
WFlags< EnumType > operator| (WFlags< EnumType > other) const
 Bitwise OR operator. More...
 
WFlags< EnumType > operator| (EnumType other) const
 Bitwise OR operator. More...
 
WFlags< EnumType > & operator|= (WFlags< EnumType > other)
 Modifying bitwise OR operator. More...
 
WFlags< EnumType > & operator|= (EnumType other)
 Modifying bitwise OR operator. More...
 
WFlags< EnumType > operator~ () const
 Inversion operator. More...
 

Detailed Description

template<typename EnumType>
class Wt::WFlags< EnumType >

Utility class for type-safe combinations of enumeration flags.

This type is used in Wt API whenever one or more flag options are expected, instead of an int. The class provides type safety, in the sense that it checks that the correct combination of enum values is bound to the argument, and does not cost any run-time overhead (internally it uses only an int to represent the combination of flags.

Member Function Documentation

◆ operator &() [1/2]

template<typename EnumType>
WFlags<EnumType> Wt::WFlags< EnumType >::operator& ( EnumType  mask) const

Bitwise AND operator.

Returns flags that are the bitwise AND of this and mask.

◆ operator &() [2/2]

template<typename EnumType>
WFlags<EnumType> Wt::WFlags< EnumType >::operator& ( MaskType  mask) const

Bitwise AND operator.

Returns flags that are the bitwise AND of this and mask.

◆ operator &=() [1/2]

template<typename EnumType>
WFlags<EnumType>& Wt::WFlags< EnumType >::operator&= ( EnumType  mask)

Modifying bitwise AND operator.

Sets as value the bitwise AND of this and mask.

◆ operator &=() [2/2]

template<typename EnumType>
WFlags<EnumType>& Wt::WFlags< EnumType >::operator&= ( MaskType  mask)

Modifying bitwise AND operator.

Sets as value the bitwise AND of this and mask.

◆ operator EnumType()

template<typename EnumType >
Wt::WFlags< EnumType >::operator EnumType ( ) const

Cast to the enum type.

The internal int representation is simply cast to the enum type, without any additional checks.

◆ operator!()

template<typename EnumType >
bool Wt::WFlags< EnumType >::operator! ( ) const

Negation operator.

Returns whether different from 0.

◆ operator^() [1/2]

template<typename EnumType>
WFlags< EnumType > Wt::WFlags< EnumType >::operator^ ( WFlags< EnumType >  other) const

Bitwise XOR operator.

Returns flags that are the bitwise XOR of this and other.

◆ operator^() [2/2]

template<typename EnumType>
WFlags< EnumType > Wt::WFlags< EnumType >::operator^ ( EnumType  other) const

Bitwise XOR operator.

Returns flags that are the bitwise XOR of this and other.

◆ operator^=() [1/2]

template<typename EnumType>
WFlags< EnumType > & Wt::WFlags< EnumType >::operator^= ( WFlags< EnumType >  other)

Modifying bitwise XOR operator.

Sets as value the bitwise XOR of this and other.

◆ operator^=() [2/2]

template<typename EnumType>
WFlags< EnumType > & Wt::WFlags< EnumType >::operator^= ( EnumType  other)

Modifying bitwise XOR operator.

Sets as value the bitwise XOR of this and other.

◆ operator|() [1/2]

template<typename EnumType>
WFlags< EnumType > Wt::WFlags< EnumType >::operator| ( WFlags< EnumType >  other) const

Bitwise OR operator.

Returns flags that are the bitwise OR of this and other.

◆ operator|() [2/2]

template<typename EnumType>
WFlags< EnumType > Wt::WFlags< EnumType >::operator| ( EnumType  other) const

Bitwise OR operator.

Returns flags that are the bitwise OR of this and other.

◆ operator|=() [1/2]

template<typename EnumType>
WFlags< EnumType > & Wt::WFlags< EnumType >::operator|= ( WFlags< EnumType >  other)

Modifying bitwise OR operator.

Sets as value the bitwise OR of this and other.

◆ operator|=() [2/2]

template<typename EnumType>
WFlags< EnumType > & Wt::WFlags< EnumType >::operator|= ( EnumType  other)

Modifying bitwise OR operator.

Sets as value the bitwise OR of this and other.

◆ operator~()

template<typename EnumType >
WFlags< EnumType > Wt::WFlags< EnumType >::operator~ ( ) const

Inversion operator.

Returns flags that are the inverted of this.


Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13