3ds Max C++ API Reference
FlagUser Class Reference

#include <mncommon.h>

+ Inheritance diagram for FlagUser:

Public Member Functions

 FlagUser ()=default
 
 FlagUser (const FlagUser &)=default
 
 FlagUser (FlagUser &&)=default
 
FlagUseroperator= (const FlagUser &)=default
 
FlagUseroperator= (FlagUser &&)=default
 
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)
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 

Detailed Description

See also
Class MNMesh.

Description:
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.

Constructor & Destructor Documentation

◆ FlagUser() [1/3]

FlagUser ( )
default
Remarks
Constructor. Sets FlagUserFlags to 0, clearing all flag bits.

◆ FlagUser() [2/3]

FlagUser ( const FlagUser )
default

◆ FlagUser() [3/3]

FlagUser ( FlagUser &&  )
default

Member Function Documentation

◆ operator=() [1/2]

FlagUser& operator= ( const FlagUser )
default

◆ operator=() [2/2]

FlagUser& operator= ( FlagUser &&  )
default

◆ SetFlag()

void SetFlag ( DWORD  fl,
bool  val = TRUE 
)
inline
Remarks
Sets flags. Each bit that is set in fl is assigned the value val.
52  {
53  if (val)
54  FlagUserFlags |= fl;
55  else
56  FlagUserFlags -= (FlagUserFlags & fl);
57  }

◆ ClearFlag()

void ClearFlag ( DWORD  fl)
inline
Remarks
Clears flags. Each bit that is set in fl is cleared.
60  {
61  FlagUserFlags -= (FlagUserFlags & fl);
62  }

◆ GetFlag()

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.
67  {
68  return bool(FlagUserFlags & fl);
69  }

◆ ClearAllFlags()

void ClearAllFlags ( )
inline
Remarks
Sets FlagUserFlags to 0, clearing all flag bits.
72  {
73  FlagUserFlags = 0;
74  }

◆ CopyFlags() [1/6]

void CopyFlags ( DWORD  fl)
inline
Remarks
Copies all flag bits over from fl.
78  {
79  FlagUserFlags = fl;
80  }

◆ CopyFlags() [2/6]

void CopyFlags ( const FlagUser fu)
inline
Remarks
Copies all flag bits over from fu.
83  {
84  FlagUserFlags = fu.FlagUserFlags;
85  }

◆ CopyFlags() [3/6]

void CopyFlags ( const FlagUser fu)
inline
Remarks
Copies all flag bits over from *fu.
88  {
89  FlagUserFlags = fu->FlagUserFlags;
90  }

◆ CopyFlags() [4/6]

void CopyFlags ( DWORD  fl,
DWORD  mask 
)
inline
Remarks
Copies from fl only those bits set in mask.
94  {
95  FlagUserFlags |= (fl & mask);
96  }

◆ CopyFlags() [5/6]

void CopyFlags ( const FlagUser fu,
DWORD  mask 
)
inline
Remarks
Copies from fu only those bits set in mask.
99  {
100  FlagUserFlags |= (fu.FlagUserFlags & mask);
101  }

◆ CopyFlags() [6/6]

void CopyFlags ( const FlagUser fu,
DWORD  mask 
)
inline
Remarks
Copies from *fu only those bits set in mask.
104  {
105  FlagUserFlags |= (fu->FlagUserFlags & mask);
106  }

◆ OrFlags() [1/2]

void OrFlags ( const FlagUser fu)
inline
Remarks
Sets all flags that are set in fu.
110  {
111  FlagUserFlags |= fu.FlagUserFlags;
112  }

◆ OrFlags() [2/2]

void OrFlags ( const FlagUser fu)
inline
Remarks
Sets all flags that are set in *fu.
115  {
116  FlagUserFlags |= fu->FlagUserFlags;
117  }

◆ AndFlags() [1/2]

void AndFlags ( const FlagUser fu)
inline
Remarks
Clears all flags that are clear in fu.
121  {
122  FlagUserFlags &= fu.FlagUserFlags;
123  }

◆ AndFlags() [2/2]

void AndFlags ( const FlagUser fu)
inline
Remarks
Clears all flags that are clear in *fu.
126  {
127  FlagUserFlags &= fu->FlagUserFlags;
128  }

◆ FlagMatch() [1/3]

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.
133  {
134  return ((FlagUserFlags & fmask) == (fl & fmask));
135  }

◆ FlagMatch() [2/3]

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.
139  {
140  return ((FlagUserFlags & fmask) == (fu.FlagUserFlags & fmask));
141  }

◆ FlagMatch() [3/3]

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.
145  {
146  return ((FlagUserFlags & fmask) == (fu->FlagUserFlags & fmask));
147  }

◆ ExportFlags()

DWORD ExportFlags ( ) const
inline
Remarks
Returns a DWORD equal to FlagUserFlags.
151  {
152  return FlagUserFlags;
153  }

◆ ImportFlags()

void ImportFlags ( DWORD  fl)
inline
Remarks
Sets FlagUserFlags equal to fl. Same as CopyFlags (fl), but it's included for "linguistic completeness".
157  {
158  FlagUserFlags = fl;
159  }

◆ WriteFlags()

IOResult WriteFlags ( ISave isave,
ULONG *  nb 
) const
inline
162  {
163  return isave->Write(&FlagUserFlags, sizeof(DWORD), nb);
164  }
IOResult Write(const char *buf, ULONG nbytes, ULONG *nwrit)
Definition: ioapi.h:251

◆ ReadFlags()

IOResult ReadFlags ( ILoad iload,
ULONG *  nb 
)
inline
166  {
167  return iload->Read(&FlagUserFlags, sizeof(DWORD), nb);
168  }
IOResult Read(const char *buf, ULONG nbytes, ULONG *nwrit)
Definition: ioapi.h:757