tsc_CustomEntityList

Available in SC version 2.10 and higher.

This class contains a list of custom entities. It is generally a snapshot of all entities at the time it was constructed from the job, however an empty list may be created. The list can be filtered in various ways to reduce it to some desired subset of all custom entities in the job.

The list does not represent the actual custom objects in the database, it is simply a read-only way to access the information. Modifying the list affects only the list; the database remains unchanged.

The list can be indexed by using the zero-based [] operator on the class to obtain a tsc_CustomEntity object. Entities obtained like this do not necessarily exist, because the user may unlink a linked job or csv file at any time, which causes all objects from that file to cease to exist. Non-existent entities are empty and their Exists property is false.

Public constructors

tsc_CustomEntityList ();
Creates an empty list.

tsc_CustomEntityList (tsc_CustomEntityList& entityList);
The copy constructor just makes a reference to the same list. Changing either list will affect the other.

Public methods

tsc_CustomEntityList Clone();
Makes a shallow copy of the list. The list itself is copied but all references are to the same objects.  Modifying one list does not affect the other.

tsc_CustomEntityList& operator= (const tsc_CustomEntityList& entityList);
Assignment is a direct reference to the original list. Changing either list will affect the other.

tsc_CustomEntityList (class tsc_EntityList& jobEntities);
Constructs a custom entity list from an entity list. Only custom elements are copied to the new list.

tsc_CustomEntity operator[] (int item);
Returns the item at the supplied zero-based index. Entities are in database (time) sequence, which is the order in which they were written.

tsc_StringList ToStringList();
Creates a list of the key values.  This list corresponds one-to-one with the original list, and keys may appear more than once.

int Count () const;
The number of entities in the list is returned.

bool IsEmpty() const;
Returns true if the list is empty.

void RemoveDeleted ();
Removes all deleted items from the list. That is, those with a deleted flag equal to true. The database is unaffected.

void SelectBy (tsc_IEntityFilter* filter);
This function allows any custom entity to be tested by a callback function and kept or removed as determined by the callback. See the documentation for tsc_IEntityFilter for details and an example. Using this function is very much faster than individually testing and removing custom entities in a list.

A NULL filter will result in no filtering - all objects will be retained.

int Find (tsc_IEntityFilter* entityTest, int startIndex = 0);
Finds the index of the next entity that matches the custom condition (see tsc_IEntityFilter). Returns -1 if no match was found in the list.

void Append (const tsc_CustomEntity& entity);
Adds a custom entity to the list. The entity may be from any database. The database is unaffected.

void Remove (const tsc_CustomEntity& entity);
Removes an item from the list. The database is unaffected.

void Remove (int index);
Removes an item from the list given its zero-based index. The database is unaffected.

void Clear ();
Removes all items from the list. The database is unaffected.