34 template<
class TInt,
unsigned _size>
57 inline std::string
asString( TInt val,
char zero =
'0',
char one =
'1' )
71 template<
class TInt,
unsigned _begin,
unsigned _size>
80 template<
class TInt,
unsigned _begin,
unsigned _size>
87 static const unsigned begin = _begin;
88 static const unsigned size = _size;
89 static const unsigned end = _begin + _size;
95 template<
class TInt,
unsigned _begin>
109 template<
class TRange,
typename TRange::IntT _value>
113 typedef typename TRange::IntT
IntT;
127 template<
class TRange,
unsigned _pos>
131 typedef typename TRange::IntT
IntT;
174 {
return _value != (TInt)0; }
178 template<
class TRange>
181 return _value & TRange::Mask::value;
189 template<
class TRange>
200 template<
class TRange>
204 | (rhs & TRange::Mask::value);
214 template<
class TRange>
217 return (
_value & TRange::Mask::value)
218 == (rhs & TRange::Mask::value);
228 template<
class TRange>
230 {
return set( (rhs & TRange::Mask::value), doset_r ); }
233 {
return doset_r ?
set( rhs ) :
unset( rhs ); }
236 template<
class TRange>
238 {
return set( rhs & TRange::Mask::value ); }
241 {
_value |= rhs;
return *
this; }
244 template<
class TRange>
246 {
return unset( rhs & TRange::Mask::value ); }
249 {
_value &= ~rhs;
return *
this; }
252 template<
class TRange>
254 {
return test( rhs & TRange::Mask::value ); }
257 {
return (
_value & rhs) == rhs; }
260 template<
class TRange>
262 {
return testAnyOf( rhs & TRange::Mask::value ); }
265 {
return (
_value & rhs); }
282 {
_value <<= num;
return *
this; }
285 {
_value >>= num;
return *
this; }
310 {
return ! (lhs == rhs); }
An integral type used as BitField.
BitField & operator|=(const BitField &rhs)
BitField & operator>>=(unsigned num)
bool testAnyOf(TInt rhs)
Test whether at least one bit of rhs is set.
bool test(TInt rhs)
Test whether all bits of rhs are set.
bool operator==(const BitField< TInt > &lhs, const BitField< TInt > &rhs)
BitField< TInt > operator&(const BitField< TInt > &lhs, const BitField< TInt > &rhs)
BitField & assign(TInt rhs)
BitField(const TInt &value_r)
Ctor taking an TInt.
BitField & set(TInt rhs, bool doset_r)
Set or unset bits of rhs.
BitField & assign(TInt rhs)
Assign Range in rhs to this.
BitField & operator<<=(unsigned num)
BitField operator~() const
BitField()
Default ctor: zero.
std::ostream & operator<<(std::ostream &str, const BitField< TInt > &obj)
Stream output.
bool operator!=(const BitField< TInt > &lhs, const BitField< TInt > &rhs)
BitField< TInt > operator|(const BitField< TInt > &lhs, const BitField< TInt > &rhs)
TInt value() const
Return the value.
std::string asString() const
BitField & unset(TInt rhs)
BitField & operator^=(const BitField &rhs)
bool testAnyOf(TInt rhs) const
BitField & operator&=(const BitField &rhs)
BitField & operator=(const BitField &rhs)
BitField & set(TInt rhs)
Set bits of rhs.
BitField< TInt > operator>>(const BitField< TInt > &lhs, unsigned num)
bool isEqual(TInt rhs) const
BitField & set(TInt rhs, bool doset_r)
bool isEqual(TInt rhs) const
Test for equal value within a Range.
std::string asString() const
Value as bit string.
bool test(TInt rhs) const
BitField & unset(TInt rhs)
Unset bits of rhs.
String related utilities and Regular expression matching.
std::string asString(TInt val, char zero='0', char one='1')
For printing bits.
Easy-to use interface to the ZYPP dependency resolver.
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
A bitmaks of _size 1-bits starting at bit _begin.
static const IntT inverted
Number of bits available in TInt.
static const unsigned value
A single 1-bit within a Range.
Range of bits starting at bit _begin with length _size.
static const unsigned end
zypp::bit::Mask< IntT, _begin, _size > Mask
zypp::bit::MaxBits< IntT > MaxBits
static const unsigned begin
static const unsigned size
Generate constants with _size trailing '1'-bits.