flags.hh (5745:6b0f8306704b) | flags.hh (5764:f07df23e1fc8) |
---|---|
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; --- 45 unchanged lines hidden (view full) --- 54 55 const Flags<T> & 56 operator=(T flags) 57 { 58 _flags = flags; 59 return *this; 60 } 61 | 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; --- 45 unchanged lines hidden (view full) --- 54 55 const Flags<T> & 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; } 66 bool none() const { return _flags == 0; } 67 bool none(Type flags) const { return (_flags & flags) == 0; } | 62 bool isSet() const { return _flags; } 63 bool isSet(Type flags) const { return (_flags & flags); } 64 bool allSet() const { return !(~_flags); } 65 bool allSet(Type flags) const { return (_flags & flags) == flags; } 66 bool noneSet() const { return _flags == 0; } 67 bool noneSet(Type flags) const { return (_flags & flags) == 0; } |
68 void clear() { _flags = 0; } 69 void clear(Type flags) { _flags &= ~flags; } 70 void set(Type flags) { _flags |= flags; } 71 void set(Type f, bool val) { _flags = (_flags & ~f) | (val ? f : 0); } 72 void 73 update(Type flags, Type mask) 74 { 75 _flags = (_flags & ~mask) | (flags & mask); 76 } 77}; 78 79#endif // __BASE_FLAGS_HH__ | 68 void clear() { _flags = 0; } 69 void clear(Type flags) { _flags &= ~flags; } 70 void set(Type flags) { _flags |= flags; } 71 void set(Type f, bool val) { _flags = (_flags & ~f) | (val ? f : 0); } 72 void 73 update(Type flags, Type mask) 74 { 75 _flags = (_flags & ~mask) | (flags & mask); 76 } 77}; 78 79#endif // __BASE_FLAGS_HH__ |