Public Member Functions

INodeTab Class Reference

Search for all occurrences

Detailed Description

Class representing a dynamic array of INodes.

#include <INodeTab.h>

Inheritance diagram for INodeTab:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void  DisposeTemporary ()
  Deletes all temporary nodes, such as those of type INodeTransformed, from the array.
int  IndexOf (INode *node)
  Finds the specified node in the array and returns its index.
bool  Contains (INode *node)
  Checks whether the specified node is in the array.
int  AppendNode (INode *node, bool allowDups=false, int allocExtra=0)
  Adds a node to the end of the array.
int  InsertNode (INode *node, int at, bool allowDups=false)
  Inserts a node into the array at the specified position.

Member Function Documentation

void DisposeTemporary ( ) [inline]

Deletes all temporary nodes, such as those of type INodeTransformed, from the array.

See also:
INodeTransformed
                            {
        for (int i=0; i<Count(); i++) {
            if ((*this)[i] != NULL) {
                (*this)[i]->DisposeTemporary();
            }
        }
    }
int IndexOf ( INode node ) [inline]

Finds the specified node in the array and returns its index.

Parameters:
node - The node to find
Returns:
int - The index of the node in this array, or -1 if the node is not found
    {
        for (int i=0; i<Count(); i++) {
            if ((*this)[i] == node) {
                return i;
            }
        }
        return -1;
    }
bool Contains ( INode node ) [inline]

Checks whether the specified node is in the array.

Parameters:
node - The node to find
Returns:
bool - true if the node is in the array, otherwise false
    {
        return (IndexOf(node) >= 0);
    }
int AppendNode ( INode node,
bool  allowDups = false,
int  allocExtra = 0 
) [inline]

Adds a node to the end of the array.

Parameters:
node - The node to add to the array
allowDups - If true, the specified node is added to the array without checking whether it's contained already in it. If false, the node is added to the array only if it doesn't exist in it yet.
allocExtra - The number of extra items by which the array should be enlarged if all its items have been filled with nodes.
Returns:
- The number of nodes in the array prior to adding the specified node
                                                                            {
        if (!allowDups && Contains(node)) {
            return Count();
        }
        return Append(1, &node, allocExtra); 
    }
int InsertNode ( INode node,
int  at,
bool  allowDups = false 
) [inline]

Inserts a node into the array at the specified position.

Parameters:
node - The node to add to the array
at - Array index where to insert the specified node. If a negative value is specified, the node will be appended to the array.
allowDups - If true, the specified node is added to the array without checking whether it's contained already in it. If false, the node is added to the array only if it doesn't exist in it yet.
Returns:
- The array index at which the node was inserted, or -1 if the node was not inserted into the array
                                                                {
        if (at < 0) {
            AppendNode(node, allowDups);
            return Count();
        }
        else if (allowDups || !Contains(node)) {
            return Insert(at, 1, &node);
        }
        return -1;
    } 

INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab
INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab INodeTab