libzypp 17.37.17
zypp::bit::BitField< TInt > Class Template Reference

An integral type used as BitField. More...

#include <zypp/Bit.h>

Inheritance diagram for zypp::bit::BitField< TInt >:

Public Member Functions

 BitField ()
 Default ctor: zero.
 BitField (const TInt &value_r)
 Ctor taking an TInt.
 operator bool () const
 Validate in a boolean context.
template<class TRange>
TInt value () const
 Return the value.
TInt value () const
template<class TRange>
std::string asString () const
 Value as bit string.
std::string asString () const
template<class TRange>
BitFieldassign (TInt rhs)
 Assign Range in rhs to this.
BitFieldassign (TInt rhs)
template<class TRange>
bool isEqual (TInt rhs) const
 Test for equal value within a Range.
bool isEqual (TInt rhs) const
template<class TRange>
BitFieldset (TInt rhs, bool doset_r)
 Set or unset bits of rhs.
BitFieldset (TInt rhs, bool doset_r)
template<class TRange>
BitFieldset (TInt rhs)
 Set bits of rhs.
BitFieldset (TInt rhs)
template<class TRange>
BitFieldunset (TInt rhs)
 Unset bits of rhs.
BitFieldunset (TInt rhs)
template<class TRange>
bool test (TInt rhs)
 Test whether all bits of rhs are set.
bool test (TInt rhs) const
template<class TRange>
bool testAnyOf (TInt rhs)
 Test whether at least one bit of rhs is set.
bool testAnyOf (TInt rhs) const
BitFieldoperator= (const BitField &rhs)
BitFieldoperator&= (const BitField &rhs)
BitFieldoperator|= (const BitField &rhs)
BitFieldoperator^= (const BitField &rhs)
BitFieldoperator<<= (unsigned num)
BitFieldoperator>>= (unsigned num)
BitField operator~ () const

Private Attributes

TInt _value

(Note that these are not member symbols.)

template<class TInt>
std::ostream & operator<< (std::ostream &str, const BitField< TInt > &obj)
 Stream output.
template<class TInt>
bool operator== (const BitField< TInt > &lhs, const BitField< TInt > &rhs)
template<class TInt>
bool operator!= (const BitField< TInt > &lhs, const BitField< TInt > &rhs)
template<class TInt>
BitField< TInt > operator& (const BitField< TInt > &lhs, const BitField< TInt > &rhs)
template<class TInt>
BitField< TInt > operator| (const BitField< TInt > &lhs, const BitField< TInt > &rhs)
template<class TInt>
BitField< TInt > operator^ (const BitField< TInt > &lhs, const BitField< TInt > &rhs)
template<class TInt>
BitField< TInt > operator<< (const BitField< TInt > &lhs, unsigned num)
template<class TInt>
BitField< TInt > operator>> (const BitField< TInt > &lhs, unsigned num)

Additional Inherited Members

Public Types inherited from zypp::bit::Range< TInt, 0, MaxBits< TInt >::value >
using IntT
using MaxBits
using Mask
Static Public Attributes inherited from zypp::bit::Range< TInt, 0, MaxBits< TInt >::value >
static const unsigned begin
static const unsigned size
static const unsigned end

Detailed Description

template<class TInt>
class zypp::bit::BitField< TInt >

An integral type used as BitField.

Most methods exist as templated and nontemplated version. The nontemplated operates on the complete BitField, while the tamplated ones are restricted to the given Range.

BitField<char> bf; // 00000000
typedef Range<char,2,3> SubField; // bits 2,3,4 in a char field
bf<SubField>.assign( -1 ); // assign SubField in -1
// to SubField in bf.
// 00011100
bf.assign( -1 ); // assign -1 to bf
// 11111111
bf<SubField>.assign( 0 ); // 11100011
BitField & assign(TInt rhs)
Assign Range in rhs to this.
Definition Bit.h:201
BitField()
Default ctor: zero.
Definition Bit.h:163
Range of bits starting at bit _begin with length _size.
Definition Bit.h:82

Definition at line 159 of file Bit.h.

Constructor & Destructor Documentation

◆ BitField() [1/2]

template<class TInt>
zypp::bit::BitField< TInt >::BitField ( )
inline

Default ctor: zero.

Definition at line 163 of file Bit.h.

◆ BitField() [2/2]

template<class TInt>
zypp::bit::BitField< TInt >::BitField ( const TInt & value_r)
inline

Ctor taking an TInt.

Definition at line 167 of file Bit.h.

Member Function Documentation

◆ operator bool()

template<class TInt>
zypp::bit::BitField< TInt >::operator bool ( ) const
inlineexplicit

Validate in a boolean context.

Definition at line 173 of file Bit.h.

◆ value() [1/2]

template<class TInt>
template<class TRange>
TInt zypp::bit::BitField< TInt >::value ( ) const
inline

Return the value.

Definition at line 179 of file Bit.h.

◆ value() [2/2]

template<class TInt>
TInt zypp::bit::BitField< TInt >::value ( ) const
inline

Definition at line 183 of file Bit.h.

◆ asString() [1/2]

template<class TInt>
template<class TRange>
std::string zypp::bit::BitField< TInt >::asString ( ) const
inline

Value as bit string.

Definition at line 190 of file Bit.h.

◆ asString() [2/2]

template<class TInt>
std::string zypp::bit::BitField< TInt >::asString ( ) const
inline

Definition at line 194 of file Bit.h.

◆ assign() [1/2]

template<class TInt>
template<class TRange>
BitField & zypp::bit::BitField< TInt >::assign ( TInt rhs)
inline

Assign Range in rhs to this.

Definition at line 201 of file Bit.h.

◆ assign() [2/2]

template<class TInt>
BitField & zypp::bit::BitField< TInt >::assign ( TInt rhs)
inline

Definition at line 207 of file Bit.h.

◆ isEqual() [1/2]

template<class TInt>
template<class TRange>
bool zypp::bit::BitField< TInt >::isEqual ( TInt rhs) const
inline

Test for equal value within a Range.

Definition at line 215 of file Bit.h.

◆ isEqual() [2/2]

template<class TInt>
bool zypp::bit::BitField< TInt >::isEqual ( TInt rhs) const
inline

Definition at line 220 of file Bit.h.

◆ set() [1/4]

template<class TInt>
template<class TRange>
BitField & zypp::bit::BitField< TInt >::set ( TInt rhs,
bool doset_r )
inline

Set or unset bits of rhs.

Definition at line 229 of file Bit.h.

◆ set() [2/4]

template<class TInt>
BitField & zypp::bit::BitField< TInt >::set ( TInt rhs,
bool doset_r )
inline

Definition at line 232 of file Bit.h.

◆ set() [3/4]

template<class TInt>
template<class TRange>
BitField & zypp::bit::BitField< TInt >::set ( TInt rhs)
inline

Set bits of rhs.

Definition at line 237 of file Bit.h.

◆ set() [4/4]

template<class TInt>
BitField & zypp::bit::BitField< TInt >::set ( TInt rhs)
inline

Definition at line 240 of file Bit.h.

◆ unset() [1/2]

template<class TInt>
template<class TRange>
BitField & zypp::bit::BitField< TInt >::unset ( TInt rhs)
inline

Unset bits of rhs.

Definition at line 245 of file Bit.h.

◆ unset() [2/2]

template<class TInt>
BitField & zypp::bit::BitField< TInt >::unset ( TInt rhs)
inline

Definition at line 248 of file Bit.h.

◆ test() [1/2]

template<class TInt>
template<class TRange>
bool zypp::bit::BitField< TInt >::test ( TInt rhs)
inline

Test whether all bits of rhs are set.

Definition at line 253 of file Bit.h.

◆ test() [2/2]

template<class TInt>
bool zypp::bit::BitField< TInt >::test ( TInt rhs) const
inline

Definition at line 256 of file Bit.h.

◆ testAnyOf() [1/2]

template<class TInt>
template<class TRange>
bool zypp::bit::BitField< TInt >::testAnyOf ( TInt rhs)
inline

Test whether at least one bit of rhs is set.

Definition at line 261 of file Bit.h.

◆ testAnyOf() [2/2]

template<class TInt>
bool zypp::bit::BitField< TInt >::testAnyOf ( TInt rhs) const
inline

Definition at line 264 of file Bit.h.

◆ operator=()

template<class TInt>
BitField & zypp::bit::BitField< TInt >::operator= ( const BitField< TInt > & rhs)
inline

Definition at line 269 of file Bit.h.

◆ operator&=()

template<class TInt>
BitField & zypp::bit::BitField< TInt >::operator&= ( const BitField< TInt > & rhs)
inline

Definition at line 272 of file Bit.h.

◆ operator|=()

template<class TInt>
BitField & zypp::bit::BitField< TInt >::operator|= ( const BitField< TInt > & rhs)
inline

Definition at line 275 of file Bit.h.

◆ operator^=()

template<class TInt>
BitField & zypp::bit::BitField< TInt >::operator^= ( const BitField< TInt > & rhs)
inline

Definition at line 278 of file Bit.h.

◆ operator<<=()

template<class TInt>
BitField & zypp::bit::BitField< TInt >::operator<<= ( unsigned num)
inline

Definition at line 281 of file Bit.h.

◆ operator>>=()

template<class TInt>
BitField & zypp::bit::BitField< TInt >::operator>>= ( unsigned num)
inline

Definition at line 284 of file Bit.h.

◆ operator~()

template<class TInt>
BitField zypp::bit::BitField< TInt >::operator~ ( ) const
inline

Definition at line 287 of file Bit.h.

◆ operator<<() [1/2]

template<class TInt>
std::ostream & operator<< ( std::ostream & str,
const BitField< TInt > & obj )
related

Stream output.

Definition at line 297 of file Bit.h.

◆ operator==()

template<class TInt>
bool operator== ( const BitField< TInt > & lhs,
const BitField< TInt > & rhs )
related

Definition at line 304 of file Bit.h.

◆ operator!=()

template<class TInt>
bool operator!= ( const BitField< TInt > & lhs,
const BitField< TInt > & rhs )
related

Definition at line 309 of file Bit.h.

◆ operator&()

template<class TInt>
BitField< TInt > operator& ( const BitField< TInt > & lhs,
const BitField< TInt > & rhs )
related

Definition at line 315 of file Bit.h.

◆ operator|()

template<class TInt>
BitField< TInt > operator| ( const BitField< TInt > & lhs,
const BitField< TInt > & rhs )
related

Definition at line 320 of file Bit.h.

◆ operator^()

template<class TInt>
BitField< TInt > operator^ ( const BitField< TInt > & lhs,
const BitField< TInt > & rhs )
related

Definition at line 325 of file Bit.h.

◆ operator<<() [2/2]

template<class TInt>
BitField< TInt > operator<< ( const BitField< TInt > & lhs,
unsigned num )
related

Definition at line 325 of file Bit.h.

◆ operator>>()

template<class TInt>
BitField< TInt > operator>> ( const BitField< TInt > & lhs,
unsigned num )
related

Definition at line 335 of file Bit.h.

Member Data Documentation

◆ _value

template<class TInt>
TInt zypp::bit::BitField< TInt >::_value
private

Definition at line 291 of file Bit.h.


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