1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SFX2_INC_BITSET_HXX
20 #define INCLUDED_SFX2_INC_BITSET_HXX
25 void CopyFrom( const BitSet
& rSet
);
30 BitSet
operator<<( sal_uInt16 nOffset
) const;
31 BitSet
operator>>( sal_uInt16 nOffset
) const;
32 static sal_uInt16
CountBits(sal_uInt32 nBits
);
33 bool operator!() const;
35 BitSet( const BitSet
& rOrig
);
37 sal_uInt16
Count() const;
38 BitSet
& operator=( const BitSet
& rOrig
);
39 BitSet
& operator=( sal_uInt16 nBit
);
40 BitSet
operator|( const BitSet
& rSet
) const;
41 BitSet
operator|( sal_uInt16 nBit
) const;
42 BitSet
& operator|=( const BitSet
& rSet
);
43 BitSet
& operator|=( sal_uInt16 nBit
);
44 BitSet
operator-( const BitSet
& rSet
) const;
45 BitSet
operator-( sal_uInt16 nId
) const;
46 BitSet
& operator-=( const BitSet
& rSet
);
47 BitSet
& operator-=( sal_uInt16 nBit
);
48 BitSet
operator&( const BitSet
& rSet
) const;
49 BitSet
& operator&=( const BitSet
& rSet
);
50 BitSet
operator^( const BitSet
& rSet
) const;
51 BitSet
operator^( sal_uInt16 nBit
) const;
52 BitSet
& operator^=( const BitSet
& rSet
);
53 BitSet
& operator^=( sal_uInt16 nBit
);
54 bool Contains( sal_uInt16 nBit
) const;
55 bool operator==( const BitSet
& rSet
) const;
56 bool operator!=( const BitSet
& rSet
) const;
60 // returns sal_True if the set is empty
61 inline bool BitSet::operator!() const
66 // returns the number of bits in the bitset
67 inline sal_uInt16
BitSet::Count() const
72 // creates the union of two bitset
73 inline BitSet
BitSet::operator|( const BitSet
& rSet
) const
75 return BitSet(*this) |= rSet
;
78 // creates the union of a bitset with a single bit
79 inline BitSet
BitSet::operator|( sal_uInt16 nBit
) const
81 return BitSet(*this) |= nBit
;
84 // creates the asymetric difference
85 inline BitSet
BitSet::operator-( const BitSet
& ) const
90 // creates the asymetric difference with a single bit
91 inline BitSet
BitSet::operator-( sal_uInt16
) const
96 // removes the bits contained in rSet
97 inline BitSet
& BitSet::operator-=( const BitSet
& )
102 // creates the intersection with another bitset
103 inline BitSet
BitSet::operator&( const BitSet
& ) const
108 // intersects with another bitset
109 inline BitSet
& BitSet::operator&=( const BitSet
& )
114 // creates the symetric difference with another bitset
115 inline BitSet
BitSet::operator^( const BitSet
& ) const
120 // creates the symetric difference with a single bit
121 inline BitSet
BitSet::operator^( sal_uInt16
) const
126 // builds the symetric difference with another bitset
127 inline BitSet
& BitSet::operator^=( const BitSet
& )
133 // builds the symetric difference with a single bit
134 inline BitSet
& BitSet::operator^=( sal_uInt16
)
141 // determines if the bitsets aren't equal
142 inline bool BitSet::operator!=( const BitSet
& rSet
) const
144 return !( *this == rSet
);
147 class IndexBitSet
: BitSet
150 sal_uInt16
GetFreeIndex();
151 void ReleaseIndex(sal_uInt16 i
){*this-=i
;}
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */