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.
Public Member Functions
|
|
NameTab
() |
|
Constructor.
|
UtilExport |
~NameTab
() |
|
Destructor.
|
UtilExport
void |
ZeroCount
() |
|
removes the items in the Tab by
un-allocating memory.
|
UtilExport
NameTab
& |
operator=
(const NameTab
&n) |
|
Assignment operator.
|
void |
SetFlag
(ULONG f, BOOL b=1) |
|
Sets the specified flag to the specified
value.
|
BOOL |
TestFlag
(ULONG f) |
|
Checks if a flag is set or not.
|
UtilExport
int |
AddName
(const MCHAR *n) |
|
Appends a copy of the specified name to the
end of the list.
|
UtilExport
void |
SetName
(int i, const MCHAR *n) |
|
Sets a name in the list.
|
UtilExport
void |
SetSize
(int num) |
|
Sets the size of the list.
|
UtilExport
void |
RemoveName
(int i) |
|
Removes the 'i-th' name from the list.
|
UtilExport
int |
FindName
(const MCHAR *n) |
|
Finds the index of the name passed in.
|
UtilExport
IOResult |
Load
(ILoad *iload) |
|
Loads this NameTab from
disk.
|
UtilExport
IOResult |
Save
(ISave *isave) |
|
Saves this NameTab to
disk.
|
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)
Reimplemented from Tab< MCHAR *
>.