home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IBITFLAG_
- #define _IBITFLAG_
- /*******************************************************************************
- * FILE NAME: ibitflag.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * IBitFlag - Abstract base class for style and attribute classes. *
- * *
- * *
- * COPYRIGHT: *
- * Licensed Materials - Property of IBM *
- * (C) Copyright IBM Corporation 1992, 1993 *
- * All Rights Reserved *
- * US Government Users Restricted Rights - Use, duplication, or disclosure *
- * restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- // $Log: S:/ibmclass/ibaseapp/vcs/ibitflag.hpv $
- //
- // Rev 1.6 25 Oct 1992 17:30:16 tsuji
- // Corrected errant semicolon.
- //
- // Rev 1.5 25 Oct 1992 16:56:52 nunn
- // changed library name to ICLUI
- //
- // Rev 1.4 25 Oct 1992 15:12:52 tsuji
- // Format/document in the style of the standard header file.
- //
- // Rev 1.3 15 Oct 1992 09:19:14 law
- // Removed excess security classification.
- //
- // Rev 1.2 13 Oct 1992 19:15:08 tsuji
- // Remove no-op virtual destructors, add IBase inheritance, show expanded
- // macros in comments.
- *******************************************************************************/
- #ifndef _IBASE_
- #include <ibase.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IBitFlag; /* bf */
-
- class IBitFlag : public IBase {
- /*******************************************************************************
- * This is the abstract base class for bitwise styles and attributes used by *
- * window and control classes in the library. As such, objects of this class *
- * cannot be created. *
- *******************************************************************************/
- typedef IBase Inherited;
- public:
- /*--------------------------------- ACCESSORS ----------------------------------
- | This function returns the value of the object. |
- | asUnsignedLong - converts object to unsigned long value |
- ------------------------------------------------------------------------------*/
- unsigned long
- asUnsignedLong() const { return ulValue; }
-
- protected:
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There is 1 way to construct instances of this class: |
- | 1. from an unsigned long value |
- | Note that this constructor is protected, since objects derived from |
- | this class should not be arbitrary constructed. To provide type safety |
- | for window/control constructors, only existing style/attribute objects |
- | (and combinations of these objects) can be specified. |
- ------------------------------------------------------------------------------*/
- IBitFlag ( unsigned long val )
- : ulValue( val ) {;}
-
- unsigned long
- ulValue;
- }; /* IBitFlag */
-
-
- /*---------------------------------- MACROS -----------------------------------
- | Below are macros to help generate the definition of classes derived from |
- | IBitFlag and friend functions necessary to combine objects of different |
- | classes. |
- ------------------------------------------------------------------------------*/
- /***************************************************************/
- // Macro for the beginning of the definition of a logical base
- // bitwise flag class (a class of bitwise flag objects which
- // cannot be constructed from a bitwise flag object of another
- // class). This class is not assumed to be nested in another
- // class definition. This macro must be followed by a list of
- // instances (separated by commas, terminated with a semicolon)
- // and the IBITFLAGCLASSDEF0END macro.
- //
- // Usage: IBITFLAGCLASSDEF0START(className)
- // flag1,
- // flag2,
- // flag3;
- // IBITFLAGCLASSDEF0END(className);
- //
- // where className is the name of the bitwise flag
- // class being created
- /***************************************************************/
- #define IBITFLAGCLASSDEF0START(className)\
- class className : public IBitFlag\
- {\
- public:\
- static const className
-
-
- /***************************************************************/
- // Macro for the end of the definition of a logical base
- // bitwise flag class (a class of bitwise flag objects which
- // cannot be constructed from a bitwise flag object of another
- // class). This class is not assumed to be nested in another
- // class definition. This macro must be preceded by the
- // IBITFLAGCLASSDEF0START and a list of instances.
- //
- // Usage: IBITFLAGCLASSDEF0START(className)
- // flag1,
- // flag2,
- // flag3;
- // IBITFLAGCLASSDEF0END(className);
- //
- // where className is the name of the bitwise flag
- // class being created
- //
- // Expands to:
- // class Negated##className : public IBitFlag
- // {
- // friend class className;
- // public:
- // Negated##className operator & ( Negated##className aFlag ) const
- // {
- // Negated##className aResult(ulValue & aFlag.ulValue);
- // return aResult;
- // }
- // protected:
- // Negated##className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // };
- // className##& operator |= ( className aFlag )
- // {
- // (*this).ulValue |= aFlag.ulValue;
- // return *this;
- // }
- // Negated##className operator ~ () const
- // {
- // return Negated##className (~ulValue);
- // }
- // className##& operator &= ( Negated##className aFlag )
- // {
- // (*this).ulValue &= aFlag.ulValue;
- // return *this;
- // }
- // className operator | ( className aFlag ) const
- // {
- // className aResult( ulValue | aFlag.ulValue );
- // return aResult;
- // }
- // className operator & ( Negated##className aFlag ) const
- // {
- // className aResult( ulValue & aFlag.ulValue );
- // return aResult;
- // }
- // unsigned long operator & ( className aFlag ) const
- // {
- // return (ulValue & aFlag.ulValue);
- // }
- // protected:
- // className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // }
- /***************************************************************/
- #define IBITFLAGCLASSDEF0END(className)\
- class Negated##className : public IBitFlag\
- {\
- friend class className;\
- public:\
- COMMONNEGBITPUBLIC0( className )\
- protected:\
- COMMONNEGBITPROTECTED( className )\
- };\
- COMMONBITPUBLIC( className )\
- COMMONBITPUBLIC0( className )\
- protected:\
- COMMONBITPROTECTED( className )\
- }
-
-
- /***************************************************************/
- // Macro for the definition of a logical base bitwise flag class
- // (a class of bitwise flag objects which cannot be constructed
- // from a bitwise flag object of another class), nested within
- // another class definition.
- //
- // Usage: INESTEDBITFLAGCLASSDEF0(className, assoc);
- // where
- // className is the name of the bitwise flag class
- // being created, and
- // assoc is the name of the window class associated
- // with (and nesting) the bitwise flag class
- // Examples: INESTEDBITFLAGCLASSDEF0(Style, IWindow);
- // INESTEDBITFLAGCLASSDEF0(Flag, IFrameWindow);
- // This macro is intended to be nested within the
- // associated class definition (e.g. the above examples
- // should be used to create the IWindow::Style and
- // IFrameWindow::Flag classes).
- //
- // Expands to:
- // class className : public IBitFlag
- // {
- // friend class assoc;
- // public:
- // class Negated##className : public IBitFlag
- // {
- // friend class className;
- // public:
- // Negated##className operator & ( Negated##className aFlag ) const
- // {
- // Negated##className aResult(ulValue & aFlag.ulValue);
- // return aResult;
- // }
- // protected:
- // Negated##className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // };
- // className##& operator |= ( className aFlag )
- // {
- // (*this).ulValue |= aFlag.ulValue;
- // return *this;
- // }
- // Negated##className operator ~ () const
- // {
- // return Negated##className (~ulValue);
- // }
- // className##& operator &= ( Negated##className aFlag )
- // {
- // (*this).ulValue &= aFlag.ulValue;
- // return *this;
- // }
- // className operator | ( className aFlag ) const
- // {
- // className aResult( ulValue | aFlag.ulValue );
- // return aResult;
- // }
- // className operator & ( Negated##className aFlag ) const
- // {
- // className aResult( ulValue & aFlag.ulValue );
- // return aResult;
- // }
- // unsigned long operator & ( className aFlag ) const
- // {
- // return (ulValue & aFlag.ulValue);
- // }
- // protected:
- // className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // }
- /***************************************************************/
- #define INESTEDBITFLAGCLASSDEF0(className, assoc)\
- class className : public IBitFlag\
- {\
- friend class assoc;\
- public:\
- class Negated##className : public IBitFlag\
- {\
- friend class className;\
- public:\
- COMMONNEGBITPUBLIC0( className )\
- protected:\
- COMMONNEGBITPROTECTED( className )\
- };\
- COMMONBITPUBLIC( className )\
- COMMONBITPUBLIC0( className )\
- protected:\
- COMMONBITPROTECTED( className )\
- }
-
-
- /***************************************************************/
- // Macro for the definition of a bitwise flag class whose objects
- // can be constructed from an object of another bitwise flag
- // class. Both bitwise flag classes are assumed to be named the
- // same, and nested within (different) class definitions.
- //
- // Usage: INESTEDBITFLAGCLASSDEF1(className, assoc, base1);
- // where
- // className is the name of the bitwise flag class
- // being created,
- // assoc is the name of the class associated with
- // (and nesting) the bitwise flag class being
- // created, and
- // base1 is the name of the class that nests the
- // bitwise flag class from which the new bitwise
- // flag class can be constructed
- // Examples:
- // INESTEDBITFLAGCLASSDEF1(Style, IControl, IWindow);
- // INESTEDBITFLAGCLASSDEF1(Style, IStaticText, IWindow);
- // This macro is intended to be nested within the
- // associated class definition (e.g. the above examples
- // should be used to create the IControl::Style and
- // IStaticText::Style classes).
- //
- // Expands to:
- // class className : public IBitFlag
- // {
- // friend class assoc;
- // public:
- // class Negated##className : public IBitFlag
- // {
- // friend class className;
- // public:
- // Negated##className ( base1##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend Negated##className operator & ( Negated##className lhs,
- // Negated##className rhs );
- // protected:
- // Negated##className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // };
- // className##& operator |= ( className aFlag )
- // {
- // (*this).ulValue |= aFlag.ulValue;
- // return *this;
- // }
- // Negated##className operator ~ () const
- // {
- // return Negated##className (~ulValue);
- // }
- // className##& operator &= ( Negated##className aFlag )
- // {
- // (*this).ulValue &= aFlag.ulValue;
- // return *this;
- // }
- // className ( base1##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend className operator | ( className lhs,
- // className rhs );
- // friend className operator & ( className lhs,
- // Negated##className rhs );
- // protected:
- // className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // }
- /***************************************************************/
- #define INESTEDBITFLAGCLASSDEF1(className, assoc, base1)\
- class className : public IBitFlag\
- {\
- friend class assoc;\
- public:\
- class Negated##className : public IBitFlag\
- {\
- friend class className;\
- public:\
- COMMONNEGBITPUBLIC1( className, base1 )\
- protected:\
- COMMONNEGBITPROTECTED( className )\
- };\
- COMMONBITPUBLIC( className )\
- COMMONBITPUBLIC1( className, base1 )\
- protected:\
- COMMONBITPROTECTED( className )\
- }
-
-
- /***************************************************************/
- // Macro for the definition of a bitwise flag class whose objects
- // can be constructed from an object of two other bitwise flag
- // classes. All the bitwise flag classes are assumed to be named
- // the same, and nested within (different) class definitions.
- //
- // Usage: INESTEDBITFLAGCLASSDEF2(className, assoc, base1, base2);
- // where
- // className is the name of the bitwise flag class
- // being created,
- // assoc is the name of the class associated with
- // (and nesting) the bitwise flag class being
- // created, and
- // base1 and base2 are the names of the classes that
- // nest the bitwise flag classes from which the new
- // bitwise flag class can be constructed
- // Examples:
- // INESTEDBITFLAGCLASSDEF2(Style, IEntryField, IWindow,
- // IControl);
- // INESTEDBITFLAGCLASSDEF2(Style, IButton, IWindow,
- // IControl);
- // This macro is intended to be nested within the
- // associated window class definition (e.g. the above
- // examples should be used to create the IEntryField::Style
- // and IButton::Style classes).
- //
- // Expands to:
- // class className : public IBitFlag
- // {
- // friend class assoc;
- // public:
- // class Negated##className : public IBitFlag
- // {
- // friend class className;
- // public:
- // Negated##className ( base1##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend Negated##className operator & ( Negated##className lhs,
- // Negated##className rhs );
- // Negated##className ( base2##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // protected:
- // Negated##className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // };
- // className##& operator |= ( className aFlag )
- // {
- // (*this).ulValue |= aFlag.ulValue;
- // return *this;
- // }
- // Negated##className operator ~ () const
- // {
- // return Negated##className (~ulValue);
- // }
- // className##& operator &= ( Negated##className aFlag )
- // {
- // (*this).ulValue &= aFlag.ulValue;
- // return *this;
- // }
- // className ( base1##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend className operator | ( className lhs,
- // className rhs );
- // friend className operator & ( className lhs,
- // Negated##className rhs );
- // className ( base2##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // protected:
- // className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // }
- /***************************************************************/
- #define INESTEDBITFLAGCLASSDEF2(className, assoc, base1, base2)\
- class className : public IBitFlag\
- {\
- friend class assoc;\
- public:\
- class Negated##className : public IBitFlag\
- {\
- friend class className;\
- public:\
- COMMONNEGBITPUBLIC1( className, base1 )\
- COMMONNEGBITPUBLICn( className, base2 )\
- protected:\
- COMMONNEGBITPROTECTED( className )\
- };\
- COMMONBITPUBLIC( className )\
- COMMONBITPUBLIC1( className, base1 )\
- COMMONBITPUBLICn( className, base2 )\
- protected:\
- COMMONBITPROTECTED( className )\
- }
-
-
- /***************************************************************/
- // Macro for the definition of a bitwise flag class whose objects
- // can be constructed from an object of three other bitwise flag
- // classes. All the bitwise flag classes are assumed to be named
- // the same, and nested within (different) class definitions.
- //
- // Usage: INESTEDBITFLAGCLASSDEF3(className, assoc, base1, base2,
- // base3)
- // where
- // className is the name of the bitwise flag class
- // being created,
- // assoc is the name of the class associated with
- // (and nesting) the bitwise flag class being
- // created, and
- // base1, base2, and base3 are the names of the
- // classes that nest the bitwise flag classes from
- // which the new bit flag class can be constructed
- // Example:
- // INESTEDBITFLAGCLASSDEF3(Style, IPushButton, IWindow,
- // IControl, IButton);
- // This macro is intended to be nested within the
- // associated class definition (e.g. the above example
- // should be used to create the IPushButton::Style class).
- //
- // Expands to:
- // class className : public IBitFlag
- // {
- // friend class assoc;
- // public:
- // class Negated##className : public IBitFlag
- // {
- // friend class className;
- // public:
- // Negated##className ( base1##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend Negated##className operator & ( Negated##className lhs,
- // Negated##className rhs );
- // Negated##className ( base2##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // Negated##className ( base3##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // protected:
- // Negated##className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // };
- // className##& operator |= ( className aFlag )
- // {
- // (*this).ulValue |= aFlag.ulValue;
- // return *this;
- // }
- // Negated##className operator ~ () const
- // {
- // return Negated##className (~ulValue);
- // }
- // className##& operator &= ( Negated##className aFlag )
- // {
- // (*this).ulValue &= aFlag.ulValue;
- // return *this;
- // }
- // className ( base1##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend className operator | ( className lhs,
- // className rhs );
- // friend className operator & ( className lhs,
- // Negated##className rhs );
- // className ( base2##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // className ( base3##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // protected:
- // className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // }
- /***************************************************************/
- #define INESTEDBITFLAGCLASSDEF3(className, assoc, base1, base2, base3)\
- class className : public IBitFlag\
- {\
- friend class assoc;\
- public:\
- class Negated##className : public IBitFlag\
- {\
- friend class className;\
- public:\
- COMMONNEGBITPUBLIC1( className, base1 )\
- COMMONNEGBITPUBLICn( className, base2 )\
- COMMONNEGBITPUBLICn( className, base3 )\
- protected:\
- COMMONNEGBITPROTECTED( className )\
- };\
- COMMONBITPUBLIC( className )\
- COMMONBITPUBLIC1( className, base1 )\
- COMMONBITPUBLICn( className, base2 )\
- COMMONBITPUBLICn( className, base3 )\
- protected:\
- COMMONBITPROTECTED( className )\
- }
-
-
- /***************************************************************/
- // Macro for the definition of a bitwise flag class whose objects
- // can be constructed from an object of four other bitwise flag
- // classes. All the bitwise flag classes are assumed to be named
- // the same, and nested within (different) class definitions.
- //
- // Usage: INESTEDBITFLAGCLASSDEF4(className, assoc, base1, base2,
- // base3, base4);
- // where
- // className is the name of the bitwise flag class
- // being created,
- // assoc is the name of the class associated with
- // (and nesting) the bitwise flag class being
- // created, and
- // base1, base2, base3, and base4 are the names of the
- // classes that nest the bitwise flag classes from
- // which the new bit flag class can be constructed
- // This macro is intended to be nested within the
- // associated class definition.
- //
- // Expands to:
- // class className : public IBitFlag
- // {
- // friend class assoc;
- // public:
- // class Negated##className : public IBitFlag
- // {
- // friend class className;
- // public:
- // Negated##className ( base1##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend Negated##className operator & ( Negated##className lhs,
- // Negated##className rhs );
- // Negated##className ( base2##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // Negated##className ( base3##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // Negated##className ( base4##::##className##::Negated##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // protected:
- // Negated##className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // };
- // className##& operator |= ( className aFlag )
- // {
- // (*this).ulValue |= aFlag.ulValue;
- // return *this;
- // }
- // Negated##className operator ~ () const
- // {
- // return Negated##className (~ulValue);
- // }
- // className##& operator &= ( Negated##className aFlag )
- // {
- // (*this).ulValue &= aFlag.ulValue;
- // return *this;
- // }
- // className ( base1##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // friend className operator | ( className lhs,
- // className rhs );
- // friend className operator & ( className lhs,
- // Negated##className rhs );
- // className ( base2##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // className ( base3##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // className ( base4##::##className aFlag )
- // : IBitFlag( aFlag.asUnsignedLong() ) {;}
- // protected:
- // className ( unsigned long val )
- // : IBitFlag( val ) {;}
- // }
- /***************************************************************/
- #define INESTEDBITFLAGCLASSDEF4(className, assoc, base1, base2, base3, base4)\
- class className : public IBitFlag\
- {\
- friend class assoc;\
- public:\
- class Negated##className : public IBitFlag\
- {\
- friend class className;\
- public:\
- COMMONNEGBITPUBLIC1( className, base1 )\
- COMMONNEGBITPUBLICn( className, base2 )\
- COMMONNEGBITPUBLICn( className, base3 )\
- COMMONNEGBITPUBLICn( className, base4 )\
- protected:\
- COMMONNEGBITPROTECTED( className )\
- };\
- COMMONBITPUBLIC( className )\
- COMMONBITPUBLIC1( className, base1 )\
- COMMONBITPUBLICn( className, base2 )\
- COMMONBITPUBLICn( className, base3 )\
- COMMONBITPUBLICn( className, base4 )\
- protected:\
- COMMONBITPROTECTED( className )\
- }
-
-
- /***************************************************************/
- // Macro for the definition of global functions that operate on
- // a class of bitwise flag objects nested within a class
- // definition. (These are global, rather than member functions,
- // to allow for communitative operations between objects of
- // different bitwise flag classes.)
- // Note: This macro should not be used to create global
- // functions for a logical base style class (one created
- // with the INESTEDBITFLAGCLASSDEF0 macro).
- //
- // Usage: INESTEDBITFLAGCLASSFUNCS(className, assoc);
- // where
- // className is the name of a bitwise flag class, and
- // assoc is the name of the class associated with
- // with (and nesting) the bitwise flag class
- // Examples: INESTEDBITFLAGCLASSFUNCS(Style, IControl);
- // INESTEDBITFLAGCLASSFUNCS(Style, IEntryField);
- // This macro should be used outside of all class
- // definitions.
- //
- // Expands to:
- // inline assoc##::##className operator | ( assoc##::##className lhs,
- // assoc##::##className rhs )
- // {
- // assoc##::##className aResult(lhs.ulValue | rhs.ulValue);
- // return aResult;
- // }
- // inline assoc##::##className
- // operator & ( assoc##::##className lhs,
- // assoc##::##className##::Negated##className rhs )
- // {
- // assoc##::##className aResult( lhs.ulValue & rhs.asUnsignedLong() );
- // return aResult;
- // }
- // inline assoc##::##className##::Negated##className
- // operator & ( assoc##::##className##::Negated##className lhs,
- // assoc##::##className##::Negated##className rhs )
- // {
- // assoc##::##className##::Negated##className aResult(lhs.ulValue & rhs.ulValue);
- // return aResult;
- // }
- // inline unsigned long operator & ( assoc##::##className lhs,
- // assoc##::##className rhs )
- // {
- // return ( lhs.asUnsignedLong() & rhs.asUnsignedLong() );
- // }
- /***************************************************************/
- #define INESTEDBITFLAGCLASSFUNCS(className, assoc)\
- inline assoc##::##className operator | ( assoc##::##className lhs,\
- assoc##::##className rhs )\
- {\
- assoc##::##className aResult(lhs.ulValue | rhs.ulValue);\
- return aResult;\
- }\
- inline assoc##::##className\
- operator & ( assoc##::##className lhs,\
- assoc##::##className##::Negated##className rhs )\
- {\
- assoc##::##className aResult( lhs.ulValue & rhs.asUnsignedLong() );\
- return aResult;\
- }\
- inline assoc##::##className##::Negated##className\
- operator & ( assoc##::##className##::Negated##className lhs,\
- assoc##::##className##::Negated##className rhs )\
- {\
- assoc##::##className##::Negated##className aResult(lhs.ulValue & rhs.ulValue);\
- return aResult;\
- }\
- inline unsigned long operator & ( assoc##::##className lhs,\
- assoc##::##className rhs )\
- {\
- return ( lhs.asUnsignedLong() & rhs.asUnsignedLong() );\
- }
-
-
- /***************************************************************/
- // Helper macros.
- // These are not intended to be used outside of this file.
- /***************************************************************/
- #define COMMONBITPUBLIC(className)\
- className##& operator |= ( className aFlag )\
- {\
- this->ulValue |= aFlag.ulValue;\
- return *this;\
- }\
- Negated##className operator ~ () const\
- {\
- return Negated##className (~ulValue);\
- }\
- className##& operator &= ( Negated##className aFlag )\
- {\
- this->ulValue &= aFlag.ulValue;\
- return *this;\
- }
- #define COMMONBITPUBLIC0(className)\
- className operator | ( className aFlag ) const\
- {\
- className aResult( ulValue | aFlag.ulValue );\
- return aResult;\
- }\
- className operator & ( Negated##className aFlag ) const\
- {\
- className aResult( ulValue & aFlag.ulValue );\
- return aResult;\
- }\
- unsigned long operator & ( className aFlag ) const\
- {\
- return (ulValue & aFlag.ulValue);\
- }
- #define COMMONBITPUBLIC1(className, baseName)\
- COMMONBITPUBLICn(className, baseName)\
- friend className operator | ( className lhs,\
- className rhs );\
- friend className operator & ( className lhs,\
- Negated##className rhs );
- #define COMMONBITPUBLICn(className, baseName)\
- className ( baseName##::##className aFlag )\
- : IBitFlag( aFlag.asUnsignedLong() ) {;}
- #define COMMONNEGBITPUBLIC0(className)\
- Negated##className operator & ( Negated##className aFlag ) const\
- {\
- Negated##className aResult(ulValue & aFlag.ulValue);\
- return aResult;\
- }
- #define COMMONNEGBITPUBLIC1(className, baseName)\
- COMMONNEGBITPUBLICn(className, baseName)\
- friend Negated##className operator & ( Negated##className lhs,\
- Negated##className rhs );
- #define COMMONNEGBITPUBLICn(className, baseName)\
- Negated##className ( baseName##::##className##::Negated##className aFlag )\
- : IBitFlag( aFlag.asUnsignedLong() ) {;}
- #define COMMONBITPROTECTED(className)\
- className ( unsigned long val )\
- : IBitFlag( val ) {;}
- #define COMMONNEGBITPROTECTED(className)\
- Negated##className ( unsigned long val )\
- : IBitFlag( val ) {;}
-
- #endif /* IBITFLAG */