3ds Max C++ API Reference
NameTab Class Reference

This class is used to store a table of names. More...

#include <nametab.h>

+ Inheritance diagram for NameTab:

Public Member Functions

 NameTab ()
 Constructor. More...
 
UtilExport ~NameTab ()
 Destructor. More...
 
UtilExport void ZeroCount ()
 removes the items in the Tab by un-allocating memory. More...
 
UtilExport NameTaboperator= (const NameTab &n)
 Assignment operator. More...
 
void SetFlag (ULONG f, BOOL b=1)
 Sets the specified flag to the specified value. More...
 
BOOL TestFlag (ULONG f)
 Checks if a flag is set or not. More...
 
UtilExport int AddName (const MCHAR *n)
 Appends a copy of the specified name to the end of the list. More...
 
UtilExport void SetName (int i, const MCHAR *n)
 Sets a name in the list. More...
 
UtilExport void SetSize (int num)
 Sets the size of the list. More...
 
UtilExport void RemoveName (int i)
 Removes the 'i-th' name from the list. More...
 
UtilExport int FindName (const MCHAR *n)
 Finds the index of the name passed in. More...
 
UtilExport IOResult Load (ILoad *iload)
 Loads this NameTab from disk. More...
 
UtilExport IOResult Save (ISave *isave)
 Saves this NameTab to disk. More...
 
- Public Member Functions inherited from Tab< const MCHAR * >
 Tab ()
 Default constructor. More...
 
 Tab (const Tab &tb)
 Copy constructor. More...
 
virtual ~Tab ()
 Destructor. More...
 
void Init ()
 Initializes a Tab instance. More...
 
int Count () const
 Retrieves the number of items in the Tab. More...
 
void ZeroCount ()
 Resets the number of used items to zero. More...
 
void SetCount (int n, BOOL resize=TRUE)
 Sets the number of used items. More...
 
const MCHAR * * Addr (const INT_PTR i) const
 Returns the address of the i-th item. More...
 
int Insert (int at, int num, const MCHAR * *el)
 Inserts items in the Tab at a specified position. More...
 
int Append (int num, const MCHAR * *el, int allocExtra=0)
 Appends items at the end of the Tab. More...
 
int Delete (int start, int num)
 Deletes items from the Tab. More...
 
int Resize (int num)
 Changes the number of items allocated in memory. More...
 
void Shrink ()
 Frees unused Tab items to reduce memory footprint. More...
 
void Sort (CompareFnc cmp)
 Sorts the array using the compare function. More...
 
Taboperator= (const Tab &tb)
 Assignment operator. More...
 
const MCHAR * & operator[] (const INT_PTR i) const
 Accesses the i-th Tab item. More...
 
const const MCHAR * * begin () const
 Accesses the begin iterator, which is a plain pointer in this case. More...
 
const MCHAR * * begin ()
 
const const MCHAR * * end () const
 Accesses the end iterator (one past last valid element). Do not dereference. More...
 
const MCHAR * * end ()
 

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

This class is used to store a table of names.

See also
Class Tab.
For example, this class is used by lights for their "Inclusion" and "Exclusion" lists.
This class maintains an 'include' flag that specifies whether the list of names is things to be included, or things to be excluded. There is no reason the NameTab class can't be used for other things where inclusion/exclusion is not relevant: in that case one can just ignore the 'include' flag. All methods are implemented by the system.

Constructor & Destructor Documentation

◆ NameTab()

NameTab ( )
inline

Constructor.

The 'include' flag is set to FALSE.

#define NT_AFFECT_SHADOWCAST
Definition: ExcludeListConstants.h:13
#define NT_AFFECT_ILLUM
Definition: ExcludeListConstants.h:12

◆ ~NameTab()

Destructor.

Member Function Documentation

◆ ZeroCount()

UtilExport void ZeroCount ( )

removes the items in the Tab by un-allocating memory.

Overrides the base class method. The Tab implementation of ZeroCount only sents the count value to zero and does not free any memory. This behavior basically guarantees a memory leak, especially with strings. To many developers have assumed that NameTab free's it's strings, by using this method, thus it's implementation is getting overridden in this class and altered. This method simply calls SetSize(0)

◆ operator=()

UtilExport NameTab& operator= ( const NameTab n)

Assignment operator.

◆ SetFlag()

void SetFlag ( ULONG  f,
BOOL  b = 1 
)
inline

Sets the specified flag to the specified value.

Parameters
f- The flag(s) to set. One or more of the following values:
  • NT_INCLUDE - This bit is used to indicate "Include" mode.
  • NT_AFFECT_ILLUM - This bit is used to indicate the "Illumination" check box in the exclusion list dialog.
  • NT_AFFECT_SHADOWCAST - This bit is used to indicate the "Shadow Casting" check box in the exclusion list dialog.
b- The value to set.
54 { if (b) flags|=f; else flags &= ~f; }

◆ TestFlag()

BOOL TestFlag ( ULONG  f)
inline

Checks if a flag is set or not.

Parameters
f- The flag(s) to set. One or more of the following values:
  • NT_INCLUDE - This bit is used to indicate "Include" mode.
  • NT_AFFECT_ILLUM - This bit is used to indicate the "Illumination" check box in the exclusion list dialog.
  • NT_AFFECT_SHADOWCAST - This bit is used to indicate the "Shadow Casting" check box in the exclusion list dialog.
  • Returns
    - Returns TRUE if the specified flag(s) are set; otherwise FALSE.
63 { return (flags&f)?1:0; }

◆ AddName()

UtilExport int AddName ( const MCHAR n)

Appends a copy of the specified name to the end of the list.

Parameters
n- The name to add.
Returns
- Returns the number of items in the list prior to appending.

◆ SetName()

UtilExport void SetName ( int  i,
const MCHAR n 
)

Sets a name in the list.

Stores the specified name at the specified position in the list.

Parameters
i- The position in the list for the name.
n- The name to store. If the name is NULL, the 'i-th' entry is set to NULL.

◆ SetSize()

UtilExport void SetSize ( int  num)

Sets the size of the list.

If the new size is smaller than the current size, the entries are deleted.

Parameters
num- Specifies the size of the list.

◆ RemoveName()

UtilExport void RemoveName ( int  i)

Removes the 'i-th' name from the list.

Parameters
i- Specifies the index of the name to remove.

◆ FindName()

UtilExport int FindName ( const MCHAR n)

Finds the index of the name passed in.

Parameters
n- The name to find.
Returns
- Returns the index of the name passed; otherwise returns -1.

◆ Load()

UtilExport IOResult Load ( ILoad iload)

Loads this NameTab from disk.

Parameters
iload- Provides methods to load data from disk.
See also
I/O Results.

◆ Save()

UtilExport IOResult Save ( ISave isave)

Saves this NameTab to disk.

Parameters
isave- Provides methods to save data to disk.
See also
I/O Results.