Table Of Contents

Previous topic

SList Details

Next topic

Data Sources

SList Details

speect object SList

A list class.

An abstract data structure that implements an ordered collection of values (of type SObject), where the same value may occur more than once.

SContainer obj

Inherit from SContainer.

SListClass Details

speect class SListClass

The list class structure.

It inherits from SContainer so that it supports different list implementations.

Protected Attributes
SContainerClass _inherit

Inherit from SContainerClass.

s_bool (*const is_empty)(const SList *self, s_erc *error)

IsEmpty function pointer.

Test to see if the given list is empty.

Parameters:
  • self

    The list container.

  • error

    Error code.

Return:

TRUE if empty else, FALSE.

size_t(*const size)(const SList *self, s_erc *error)

Size function pointer.

Return the number of SObject in the list.

Parameters:
  • self

    The list container.

  • error

    Error code.

Return:

The number of SObject objects in the list.

void(*const append)(SList *self, const SObject *object, s_erc *error)

Append function pointer.

Append an SObject to end of list.

Parameters:
  • self

    The list container.

  • object

    SObject to append to end of list.

  • error

    Error code.

void(*const prepend)(SList *self, const SObject *object, s_erc *error)

Prepend function pointer.

Prepend SObject to beginning of list.

Parameters:
  • self

    The list container.

  • object

    SObject to prepend to beginning of list.

  • error

    Error code.

void(*const insert_before)(SList *self, SIterator *itr, const SObject *object, s_erc *error)

InsertBefore function pointer.

Insert an SObject before the one currently pointed to by the iterator.

Parameters:
  • self

    The list container.

  • itr

    Iterator to current list object.

  • object

    SObject to insert.

  • error

    Error code.

void(*const insert_after)(SList *self, SIterator *itr, const SObject *object, s_erc *error)

InsertAfter function pointer.

Insert an SObject after the one currently pointed to by the iterator.

Parameters:
  • self

    The list container.

  • itr

    Iterator to current list object.

  • object

    SObject to insert.

  • error

    Error code.

void(*const merge)(SList *self, const SList *with, s_erc *error)

Merge function pointer.

Merge two lists. Append all the SObject of one list onto another list. For example:

	 self = (12, "a", 0.9644)
	 with = (5.31, "a")

	 SListMerge(self, with, error);

	 self = (12, "a", 0.9644, 5.31, "a")
	 with = (5.31, "a")

Parameters:
  • self

    The list container that with is merged with.

  • with

    The list to merge with self.

  • error

    Error code.

SList *(*const copy)(SList *dst, const SList *src, s_erc *error)

Copy (shallow) function pointer.

Copy the list objects from src to dst. If dst does not exist a new one will be created.

Parameters:
  • dst

    Pointer to destination list. If NULL then a new list will be created.

  • src

    Pointer to source list.

  • error

    Error code.

Return:

Pointer to destination list.

void(*const push)(SList *self, const SObject *object, s_erc *error)

Push function pointer.

Push SObject into end of list.

Parameters:
  • self

    The list container.

  • object

    SObject to push into end of list.

  • error

    Error code.

SObject *(*const pop)(SList *self, s_erc *error)

Pop function pointer.

Pop SObject from end of SList.

Parameters:
  • self

    The list container.

  • error

    Error code.

Return:

SObject popped from end of list.

Note:

The SObject is unlinked from the list and it’s memory is the responsibility of the caller.

void(*const reverse)(SList *self, s_erc *error)

Reverse function pointer.

Reverse the order of the elements in the list in place.

Parameters:
  • self

    The list container to reverse.

  • error

    Error code.

const SObject *(*const nth)(const SList *self, uint32 n, s_erc *error)

Nth function pointer.

Return a pointer to the nth SObject in the list.

Parameters:
  • self

    The list container.

  • n

    Index of the SObject.

  • error

    Error code.

Return:

SObject at index n.

Note:

Indexing starts at 0.

s_bool (*const val_present)(const SList *self, const SObject *object, s_erc *error)

ValPresent function pointer.

Test if the given SObject in the list.

Parameters:
  • self

    The list container.

  • object

    The SObject to test for.

  • error

    Error code.

Return:

TRUE or FALSE.

Note:

The SObjectClass function pointer compare must be implemented for the given object type (class).