flags.hh (5734:f3733e2b19d5) flags.hh (5745:6b0f8306704b)
1/*
2 * Copyright (c) 2008 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 47 unchanged lines hidden (view full) ---

56 operator=(T flags)
57 {
58 _flags = flags;
59 return *this;
60 }
61
62 bool any() const { return _flags; }
63 bool any(Type flags) const { return (_flags & flags); }
1/*
2 * Copyright (c) 2008 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 47 unchanged lines hidden (view full) ---

56 operator=(T flags)
57 {
58 _flags = flags;
59 return *this;
60 }
61
62 bool any() const { return _flags; }
63 bool any(Type flags) const { return (_flags & flags); }
64 bool all() const { return (~_flags); }
65 bool all(Type flags) const { return (_flags & flags) != flags; }
64 bool all() const { return !(~_flags); }
65 bool all(Type flags) const { return (_flags & flags) == flags; }
66 bool none() const { return _flags == 0; }
67 bool none(Type flags) const { return (_flags & flags) == 0; }
66 bool none() const { return _flags == 0; }
67 bool none(Type flags) const { return (_flags & flags) == 0; }
68 bool exact(Type flags) const { return _flags = flags; }
69 void clear() { _flags = 0; }
70 void clear(Type flags) { _flags &= ~flags; }
68 void clear() { _flags = 0; }
69 void clear(Type flags) { _flags &= ~flags; }
71 void reset(Type flags) { _flags = flags;}
72 void set(Type flags) { _flags |= flags; }
70 void set(Type flags) { _flags |= flags; }
73 void set(Type f, bool val) { _flags = (_flags & f) | (val ? f : 0); }
71 void set(Type f, bool val) { _flags = (_flags & ~f) | (val ? f : 0); }
74 void
75 update(Type flags, Type mask)
76 {
77 _flags = (_flags & ~mask) | (flags & mask);
78 }
79};
80
81#endif // __BASE_FLAGS_HH__
72 void
73 update(Type flags, Type mask)
74 {
75 _flags = (_flags & ~mask) | (flags & mask);
76 }
77};
78
79#endif // __BASE_FLAGS_HH__