Public Member Functions

FlagUser Class Reference

Search for all occurrences

Detailed Description

See also:
Class MNMesh.

Description:
This class is available in release 2.0 and later only.

This is a handy class to subclass off of when you're designing a class with flags. It contains one private data member, a DWORD, with the flag info. It then implements a bunch of handy flag-related functions. All methods of this class are implemented by the system.
Data Members:
private:

DWORD FlagUserFlags;

Stores the flags.

#include <mncommon.h>

Inheritance diagram for FlagUser:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  FlagUser ()
void  SetFlag (DWORD fl, bool val=TRUE)
void  ClearFlag (DWORD fl)
bool  GetFlag (DWORD fl) const
void  ClearAllFlags ()
void  CopyFlags (DWORD fl)
void  CopyFlags (const FlagUser &fu)
void  CopyFlags (const FlagUser *fu)
void  CopyFlags (DWORD fl, DWORD mask)
void  CopyFlags (const FlagUser &fu, DWORD mask)
void  CopyFlags (const FlagUser *fu, DWORD mask)
void  OrFlags (const FlagUser &fu)
void  OrFlags (const FlagUser *fu)
void  AndFlags (const FlagUser &fu)
void  AndFlags (const FlagUser *fu)
bool  FlagMatch (DWORD fmask, DWORD fl) const
bool  FlagMatch (DWORD fmask, const FlagUser &fu) const
bool  FlagMatch (DWORD fmask, const FlagUser *fu) const
DWORD  ExportFlags () const
void  ImportFlags (DWORD fl)
IOResult  WriteFlags (ISave *isave, ULONG *nb) const
IOResult  ReadFlags (ILoad *iload, ULONG *nb)

Constructor & Destructor Documentation

FlagUser ( ) [inline]
Remarks:
Constructor. Sets FlagUserFlags to 0, clearing all flag bits.
{ FlagUserFlags=0; }

Member Function Documentation

void SetFlag ( DWORD  fl,
bool  val = TRUE 
) [inline]
Remarks:
Sets flags. Each bit that is set in fl is assigned the value val.
{ if (val) FlagUserFlags |= fl; else FlagUserFlags -= (FlagUserFlags & fl); }
void ClearFlag ( DWORD  fl ) [inline]
Remarks:
Clears flags. Each bit that is set in fl is cleared.

Reimplemented in MNMesh.

{ FlagUserFlags -= (FlagUserFlags & fl); }
bool GetFlag ( DWORD  fl ) const [inline]
Remarks:
Checks if flags are set.
Returns:
TRUE if any of the bits set in fl are set in this FlagUser. FALSE if none of them are.
{ return (FlagUserFlags & fl) ? 1 : 0; }
void ClearAllFlags ( ) [inline]
Remarks:
Sets FlagUserFlags to 0, clearing all flag bits.
{ FlagUserFlags = 0; }
void CopyFlags ( DWORD  fl ) [inline]
Remarks:
Copies all flag bits over from fl.
{ FlagUserFlags = fl; }
void CopyFlags ( const FlagUser fu ) [inline]
Remarks:
Copies all flag bits over from fu.
{ FlagUserFlags = fu.FlagUserFlags; }
void CopyFlags ( const FlagUser fu ) [inline]
Remarks:
Copies all flag bits over from *fu.
{ FlagUserFlags = fu->FlagUserFlags; }
void CopyFlags ( DWORD  fl,
DWORD  mask 
) [inline]
Remarks:
Copies from fl only those bits set in mask.
{ FlagUserFlags |= (fl & mask); }
void CopyFlags ( const FlagUser fu,
DWORD  mask 
) [inline]
Remarks:
Copies from fu only those bits set in mask.
{ FlagUserFlags |= (fu.FlagUserFlags & mask); }
void CopyFlags ( const FlagUser fu,
DWORD  mask 
) [inline]
Remarks:
Copies from *fu only those bits set in mask.
{ FlagUserFlags |= (fu->FlagUserFlags & mask); }
void OrFlags ( const FlagUser fu ) [inline]
Remarks:
Sets all flags that are set in fu.
{ FlagUserFlags |= fu.FlagUserFlags; }
void OrFlags ( const FlagUser fu ) [inline]
Remarks:
Sets all flags that are set in *fu.
{ FlagUserFlags |= fu->FlagUserFlags; }
void AndFlags ( const FlagUser fu ) [inline]
Remarks:
Clears all flags that are clear in fu.
{ FlagUserFlags &= fu.FlagUserFlags; }
void AndFlags ( const FlagUser fu ) [inline]
Remarks:
Clears all flags that are clear in *fu.
{ FlagUserFlags &= fu->FlagUserFlags; }
bool FlagMatch ( DWORD  fmask,
DWORD  fl 
) const [inline]
Remarks:
Checks whether all the bits that are set in fmask are the same in this FlagUser and in fl.
                                                 {
        return ((FlagUserFlags & fmask) == (fl & fmask));
    }
bool FlagMatch ( DWORD  fmask,
const FlagUser fu 
) const [inline]
Remarks:
Checks whether all the bits that are set in fmask are the same in this FlagUser and in fu.
                                                            {
        return ((FlagUserFlags & fmask) == (fu.FlagUserFlags & fmask));
    }
bool FlagMatch ( DWORD  fmask,
const FlagUser fu 
) const [inline]
Remarks:
Checks whether all the bits that are set in fmask are the same in this FlagUser and in *fu.
                                                            {
        return ((FlagUserFlags & fmask) == (fu->FlagUserFlags & fmask));
    }
DWORD ExportFlags ( ) const [inline]
Remarks:
Returns a DWORD equal to FlagUserFlags.
{ return FlagUserFlags; }
void ImportFlags ( DWORD  fl ) [inline]
Remarks:
Sets FlagUserFlags equal to fl. Same as CopyFlags (fl), but it's included for "linguistic completeness".
{ FlagUserFlags = fl; }
IOResult WriteFlags ( ISave isave,
ULONG *  nb 
) const [inline]
                                                        {
        return isave->Write(&FlagUserFlags, sizeof(DWORD), nb);
    }
IOResult ReadFlags ( ILoad iload,
ULONG *  nb 
) [inline]
                                                 {
        return iload->Read (&FlagUserFlags, sizeof(DWORD), nb);
    }

FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser
FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser FlagUser