OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TBitSet< T > Class Template Reference

Simplifies setting and testing bits in a 32 count array of uint8 (32 bytes). More...

#include <owl/bitset.h>

Public Member Functions

 TBitSet ()
 Constructs a TBitSet object with all bits set to 0.
 
 TBitSet (const TBitSet &src)
 Constructs a TBitSet object as a copy of another TBitSet.
 
bool Has (T item) const
 Return true if a bit is turned on.
 
TBitSet operator~ () const
 Negate a bit.
 
void DisableItem (T item)
 Turn off a specific bit.
 
void EnableItem (T item)
 Turn on a specific bit.
 
TBitSetoperator+= (T item)
 Enable a specific bit.
 
TBitSetoperator-= (T item)
 Disable a specific bit.
 
void DisableItem (const TBitSet &bs)
 Turn off all the given bits.
 
void EnableItem (const TBitSet &bs)
 Turn on all the given bits.
 
TBitSetoperator+= (const TBitSet &bs)
 Enable all the given bits.
 
TBitSetoperator|= (const TBitSet &bs)
 Enable all the given bits.
 
TBitSetoperator-= (const TBitSet &bs)
 Disable all the given bits.
 
TBitSetoperator&= (const TBitSet &bs)
 Logically AND each individual bits.
 
bool IsEmpty () const
 Return true if all bits are off.
 

Friends

TBitSet operator& (const TBitSet &bs1, const TBitSet &bs2)
 
TBitSet operator| (const TBitSet &bs1, const TBitSet &bs2)
 
int operator== (const TBitSet &bs1, const TBitSet &bs2)
 
int operator!= (const TBitSet &bs1, const TBitSet &bs2)
 
opstreamoperator<< (opstream &out, const TBitSet &bs)
 
ipstreamoperator>> (ipstream &in, TBitSet &bs)
 

Detailed Description

template<class T = uint8>
class owl::TBitSet< T >

Simplifies setting and testing bits in a 32 count array of uint8 (32 bytes).

TBitSet sets or clears a single bit or a group of bits. You can use this class to set and clear option flags and to retrieve information about a set of bits. The class TCharSet performs similar operations for a string of characters.

Definition at line 36 of file bitset.h.

Constructor & Destructor Documentation

◆ TBitSet() [1/2]

template<class T >
owl::TBitSet< T >::TBitSet ( )

Constructs a TBitSet object with all bits set to 0.

Definition at line 21 of file bitset.cpp.

◆ TBitSet() [2/2]

template<class T >
owl::TBitSet< T >::TBitSet ( const TBitSet< T > & src)

Constructs a TBitSet object as a copy of another TBitSet.

Definition at line 31 of file bitset.cpp.

Member Function Documentation

◆ DisableItem() [1/2]

template<class T >
void owl::TBitSet< T >::DisableItem ( const TBitSet< T > & bs)

Turn off all the given bits.

Definition at line 105 of file bitset.cpp.

◆ DisableItem() [2/2]

template<class T >
void owl::TBitSet< T >::DisableItem ( T item)

Turn off a specific bit.

Definition at line 65 of file bitset.cpp.

◆ EnableItem() [1/2]

template<class T >
void owl::TBitSet< T >::EnableItem ( const TBitSet< T > & bs)

Turn on all the given bits.

Definition at line 116 of file bitset.cpp.

◆ EnableItem() [2/2]

template<class T >
void owl::TBitSet< T >::EnableItem ( T item)

Turn on a specific bit.

Definition at line 75 of file bitset.cpp.

◆ Has()

template<class T >
bool owl::TBitSet< T >::Has ( T item) const

Return true if a bit is turned on.

Definition at line 42 of file bitset.cpp.

◆ IsEmpty()

template<class T >
bool owl::TBitSet< T >::IsEmpty ( ) const

Return true if all bits are off.

Definition at line 169 of file bitset.cpp.

◆ operator&=()

template<class T >
TBitSet< T > & owl::TBitSet< T >::operator&= ( const TBitSet< T > & bs)

Logically AND each individual bits.

Definition at line 157 of file bitset.cpp.

◆ operator+=() [1/2]

template<class T >
TBitSet< T > & owl::TBitSet< T >::operator+= ( const TBitSet< T > & bs)

Enable all the given bits.

Definition at line 126 of file bitset.cpp.

◆ operator+=() [2/2]

template<class T >
TBitSet< T > & owl::TBitSet< T >::operator+= ( T item)

Enable a specific bit.

Definition at line 84 of file bitset.cpp.

◆ operator-=() [1/2]

template<class T >
TBitSet< T > & owl::TBitSet< T >::operator-= ( const TBitSet< T > & bs)

Disable all the given bits.

Definition at line 146 of file bitset.cpp.

◆ operator-=() [2/2]

template<class T >
TBitSet< T > & owl::TBitSet< T >::operator-= ( T item)

Disable a specific bit.

Definition at line 94 of file bitset.cpp.

◆ operator|=()

template<class T >
TBitSet< T > & owl::TBitSet< T >::operator|= ( const TBitSet< T > & bs)

Enable all the given bits.

Definition at line 136 of file bitset.cpp.

◆ operator~()

template<class T >
TBitSet< T > owl::TBitSet< T >::operator~ ( ) const

Negate a bit.

Definition at line 52 of file bitset.cpp.

Friends And Related Symbol Documentation

◆ operator!=

template<class T = uint8>
int operator!= ( const TBitSet< T > & bs1,
const TBitSet< T > & bs2 )
friend

Definition at line 111 of file bitset.h.

◆ operator&

template<class T = uint8>
TBitSet operator& ( const TBitSet< T > & bs1,
const TBitSet< T > & bs2 )
friend

Definition at line 95 of file bitset.h.

◆ operator<<

template<class T = uint8>
opstream & operator<< ( opstream & out,
const TBitSet< T > & bs )
friend

Definition at line 67 of file bitset.h.

◆ operator==

template<class T = uint8>
int operator== ( const TBitSet< T > & bs1,
const TBitSet< T > & bs2 )
friend

Definition at line 86 of file bitset.h.

◆ operator>>

template<class T = uint8>
ipstream & operator>> ( ipstream & in,
TBitSet< T > & bs )
friend

Definition at line 72 of file bitset.h.

◆ operator|

template<class T = uint8>
TBitSet operator| ( const TBitSet< T > & bs1,
const TBitSet< T > & bs2 )
friend

Definition at line 103 of file bitset.h.


The documentation for this class was generated from the following files: