Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
container
bitXmask.h
Go to the documentation of this file.
1
/* bitXmask.h
2
*/
3
#ifndef OSL_BITXMASK_H
4
#define OSL_BITXMASK_H
5
6
#include "
osl/square.h
"
7
#include "
osl/misc/carray.h
"
8
#include <iosfwd>
9
10
namespace
osl
11
{
12
namespace
container
13
{
17
class
BitXmask
18
{
19
int
mask
;
20
public
:
21
BitXmask
() :
mask
(0) {}
22
void
clearAll
() {
mask
= 0; }
23
void
set
(
int
x) {
mask
|= (1 << x); }
24
void
clear
(
int
x) {
mask
&= ~(1 << x); }
25
26
void
set
(
Square
position) {
set
(position.
x
()); }
27
void
clear
(
Square
position) {
clear
(position.
x
()); }
28
29
bool
isSet
(
int
x)
const
{
return
mask
& (1<<x); }
30
31
int
intValue
()
const
{
return
mask
; }
32
};
33
34
inline
bool
operator==
(
BitXmask
l,
BitXmask
r)
35
{
36
return
l.
intValue
() == r.
intValue
();
37
}
38
inline
bool
operator!=
(
BitXmask
l,
BitXmask
r)
39
{
40
return
! (l == r);
41
}
42
inline
bool
operator<
(
BitXmask
l,
BitXmask
r)
43
{
44
return
l < r;
45
}
46
47
std::ostream&
operator<<
(std::ostream&,
const
BitXmask);
48
}
// namespace container
49
using
container::BitXmask;
50
}
// namespace osl
51
52
#endif
/* OSL_BITXMASK_H */
53
// ;;; Local Variables:
54
// ;;; mode:c++
55
// ;;; c-basic-offset:2
56
// ;;; coding:utf-8
57
// ;;; End:
Generated on Sun Jul 21 2013 13:37:23 by
1.8.4