DSListElement


Abstract

A unit capable of being stored in a Linked List.

Discussion

A ListElement contains a key, value, and details about how to clean up after itself. It can only have one key, numeric or string, and one value.

Member Functions


DSListElement


public:

DSListElement (     int cleanup=0 );
Discussion

Creates a new ListElement.

Parameter Descriptions
cleanup
Specifies the cleanup flags that apply to this ListElement.

DSListElement


public:

DSListElement (     DSListElement * le );
Discussion

Copies a ListElement; does not copy the data contained inside.

Parameter Descriptions
le
Specifies the ListElement to copy.

DSListElement


public:

DSListElement (     char* Key,     void* Data,     DSListElement* Next,     int Cleanup=0 );
Discussion

Creates a new ListElement.

Parameter Descriptions
Key
Specifies the string key of the new element. This pointer is used in the element, copy data yourself.
Data
Specifies the value of the new element. This pointer is used in the element, copy data yourself.
Next
Points to the next ListElement in the List.
Cleanup
Specifies the cleanup flags that apply to this ListElement.

DSListElement


public:

DSListElement (     unsigned int Key,     void* Data,     DSListElement* Next,     int Cleanup=0 );
Discussion

Creates a new ListElement.

Parameter Descriptions
Key
Specifies the numeric key of the new element.
Data
Specifies the value of the new element. This pointer is used in the element, copy data yourself.
Next
Points to the next ListElement in the List.
Cleanup
Specifies the cleanup flags that apply to this ListElement.

DSListElement


public:

DSListElement (     char* Key,     unsigned int Data,     DSListElement* Next,     int Cleanup=0 );
Discussion

Creates a new ListElement.

Parameter Descriptions
Key
Specifies the string key of the new element. This pointer is used in the element, copy data yourself.
Data
Specifies the numeric value of the new element.
Next
Points to the next ListElement in the List.
Cleanup
Specifies the cleanup flags that apply to this ListElement.

DSListElement


public:

DSListElement (     unsigned int Key,     unsigned int Data,     DSListElement* Next,     int Cleanup=0 );
Discussion

Creates a new ListElement.

Parameter Descriptions
Key
Specifies the numeric key of the new element.
Data
Specifies the numeric value of the new element.
Next
Points to the next ListElement in the List.
Cleanup
Specifies the cleanup flags that apply to this ListElement.

getDataInt


public:

unsigned int getDataInt (void);
Discussion

Retrieves the numeric value of the ListElement.

function result
The numeric value of the ListElement, or 0, if the ListElement contains a pointer.

getDataPtr


public:

void* getDataPtr (void);
Discussion

Retrieves the pointer value of the ListElement.

function result
The pointer value of the ListElement, or NULL, if the ListElement contains a number.

getKeyInt


public:

unsigned int getKeyInt (void);
Discussion

Retrieves the numeric key of the ListElement.

function result
The numeric key of the ListElement, or 0, if the key is a string.

getKeyString


public:

char* getKeyString (void);
Discussion

Retrieves the string key of the ListElement.

function result
The string key of the ListElement, or NULL, if the key is numeric.

getNext


public:

DSListElement* getNext (void);
Discussion

Retrieves the next ListElement.

function result
A pointer to the next ListElement, or NULL, if there is no following element.

setCleanup


public:

void setCleanup (     int Cleanup );
Discussion

Modifies the cleanup flags.

Parameter Descriptions
Cleanup
The new cleanup flags.

setDataInt


public:

void setDataInt (     unsigned int Data );
Discussion

Modifies the value in the ListElement. Any previous value is destroyed.

Parameter Descriptions
Data
The new numeric value.

setDataPtr


public:

void setDataPtr (     void * Data );
Discussion

Modifies the value in the ListElement. Any previous value is destroyed.

Parameter Descriptions
Data
The new pointer value. This pointer is inserted into the ListElement and is not copied.

setKeyInt


public:

void setKeyInt (     unsigned int Key );
Discussion

Modifies the key in the ListElement. Any previous key is destroyed.

Parameter Descriptions
Key
The new numeric value.

setKeyInt


public:

void setKeyString (     char * Key );
Discussion

Modifies the key in the ListElement. Any previous key is destroyed.

Parameter Descriptions
Key
The new string value. This pointer is used directly, not copied; make sure you have copied it yourself if you'd like the ListElement to keep it.

setNext


public:

void setNext (     DSListElement* Next );
Discussion

Modifies the next the ListElement.

Parameter Descriptions
Next
The new next ListElement.

~ListElement


public:

~DSListElement (void);
Discussion

Destroys the ListElement.

Member Data


Cleanup


public:
    enum {
      CLEANUP_KEY_FREE=16,
      CLEANUP_KEY_DELETE=32,
      CLEANUP_VALUE_FREE=64,
      CLEANUP_ALL=112
    };
Discussion

Cleanup flags

Constants
CLEANUP_KEY_FREE
Specifies that the key should be cleaned up using free() when it's disposed.
CLEANUP_KEY_DELETE
Specifies that the key should be cleaned up using delete when it's disposed.
CLEANUP_VALUE_FREE
Specifies that the value should be cleaned up using free() when it's disposed.

(Last Updated 9/24/2004)