Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Flags.h

Go to the documentation of this file.
00001 /*
00002     File:       Flags.h
00003 
00004     Function:   
00005 
00006     Author:     Andrew Willmott
00007 
00008     Copyright:  (c) 1998-2000, Andrew Willmott
00009 */
00010 
00011 #ifndef __Flags__
00012 #define __Flags__
00013 
00014 #include "cl/Basics.h"
00015 
00016 class Flags32
00017 {
00018 public:
00019     Flags32() : bits(0) {};
00020 
00021     Void        Set(UInt32 flag)
00022                 { bits |= flag; };
00023     Void        UnSet(UInt32 flag)
00024                 { bits &= ~flag; };
00025     Bool        IsSet(UInt32 flag)          
00026                 { return(bits & flag); };
00027     Bool        AreSet(UInt32 flags)        
00028                 { return((bits & flags) == flags); };
00029     Void        Clear()
00030                 { bits = 0; };  
00031 
00032                 operator UInt32()
00033                 { return(bits); };
00034 
00035 protected:
00036     UInt32      bits;
00037 };
00038 
00039 class Flags16
00040 {
00041 public:
00042     Flags16() : bits(0) {};
00043 
00044     Void        Set(UInt16 flag)
00045                 { bits |= flag; };
00046     Void        UnSet(UInt16 flag)
00047                 { bits &= ~flag; };
00048     Bool        IsSet(UInt16 flag)
00049                 { return(bits & flag); };
00050     Bool        AreSet(UInt32 flags)
00051                 { return((bits & flags) == flags); };
00052     Void        Clear()
00053                 { bits = 0; };  
00054 
00055                 operator UInt16()
00056                 { return(bits); };
00057     
00058 protected:
00059     UInt16      bits;
00060 };
00061 
00062 class Flags8
00063 {
00064 public:
00065     Flags8() : bits(0) {};
00066 
00067     Void        Set(Byte flag)
00068                 { bits |= flag; };
00069     Void        UnSet(Byte flag)
00070                 { bits &= ~flag; };
00071     Bool        IsSet(Byte flag)
00072                 { return(bits & flag); };
00073     Bool        AreSet(UInt32 flags)
00074                 { return((bits & flags) == flags); };
00075     Void        Clear()
00076                 { bits = 0; };  
00077 
00078                 operator Byte()
00079                 { return(bits); };
00080     
00081 protected:
00082     Byte        bits;
00083 };
00084 
00085 #endif

Generated at Sat Aug 5 00:16:32 2000 for Class Library by doxygen 1.1.0 written by Dimitri van Heesch, © 1997-2000