| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# csutil/flags.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2000 by Jorrit Tyberghein
    00003
    00004     This library is free software; you can redistribute it and/or
    00005     modify it under the terms of the GNU Library General Public
    00006     License as published by the Free Software Foundation; either
    00007     version 2 of the License, or (at your option) any later version.
    00008
    00009     This library is distributed in the hope that it will be useful,
    00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012     Library General Public License for more details.
    00013
    00014     You should have received a copy of the GNU Library General Public
    00015     License along with this library; if not, write to the Free
    00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00017 */
    00018
    00019 #ifndef __CS_FLAGS_H__
    00020 #define __CS_FLAGS_H__
    00021
    00026 #include "csextern.h"
    00027
    00031 class csFlags
    00032 {
    00033 private:
    00035   uint32 flags;
    00036
    00037 public:
    00039   csFlags (uint32 value = 0) : flags (value) { }
    00040
    00047   void SetAll (uint32 value)
    00048   { flags = value; }
    00049
    00056   void Set (uint32 mask)
    00057   { flags = (flags & ~mask) | mask; }
    00058
    00065   void Reset (uint32 mask)
    00066   { flags = (flags & ~mask); }
    00067
    00073   void Set (uint32 mask, uint32 value)
    00074   { flags = (flags & ~mask) | (value & mask); }
    00075
    00081   void SetBool (uint32 mask, bool value)
    00082   {
    00083     if (value)
    00084       flags |= mask;
    00085     else
    00086       flags &= ~mask;
    00087   }
    00088
    00090   uint32 Get () const
    00091   { return flags; }
    00092
    00094   bool Check (uint32 mask) const
    00095   { return (flags & mask) != 0; }
    00096
    00098   bool CheckAll (uint32 mask) const
    00099   { return (flags & mask) == mask; }
    00100 };
    00101
    00102 #endif // __CS_FLAGS_H__
    00103