Lists of objects of type Element
Lists of objects of type Element
static ElementList elementlist::alloc()
Create a new empty list of type ElementList.
| Name | Type | Default | Description |
| Return | ElementList | New ElementList. |
static int elementlist::release(ElementList li, int releaseItems = 1)
Delete a list again that was created with elementlist::alloc
| Name | Type | Default | Description |
| li | ElementList | - | List to be deleted |
| releaseItems | int | 1 | Release lists objects too? 1 : Yes 0 : No, do not delete list items |
static int elementlist::length(ElementList li)
Ascertain the number of elements of a list
| Name | Type | Default | Description |
| Return | int | Number of entries in the list | |
| li | ElementList | - | List of elements |
static Element elementlist::get(
ElementList li,
int pos,
int setPos= 0)
Get the i-th element of the list. Positions are 0-based, the first element has the position 0, the final the position length-1.
| Name | Type | Default | Description |
| Return | Element | Value of the list at the position i or 0. | |
| li | ElementList | - | List from which the element is to be fetched |
| pos | int | - | 0-based list position |
| setPos | int | 0 | 0 : Leave list positions unchanged 1 : Set current list position to pos |
static int elementlist::append(ElementList li, Element element)
Append element to the list
| Name | Type | Default | Description |
| Return | int | appended object or 0 | |
| li | ElementList | - | List to which the append is to be made |
| ⇨ Get the values for the new list entry from an Element object | |||
| element | Element | - | element with the values for the object to be appened |
| ⇨ Get the values for the new list entry directly | |||
| id1 | int | - | First number of new element |
| id2 | int | - | Second number of new element |
| id3 | int | - | Third number of new element |
| strid | String oder char* | - | StringID of new element |
static int elementlist::insert(
ElementList li,
int pos,
Element val)
Insert element into the list.
| Name | Type | Default | Description |
| Return | int | inserted object or 0 | |
| li | ElementList | - | list to which the insert is to be made |
| pos | int | - | 0-based index of insert < 0 or >= length : Append otherwise : Insert at this position |
| ⇨ Get the values for the new list entry from an Element object | |||
| element | Element | - | element with the values for the object to be inserted |
| ⇨ Get the values for the new list entry directly | |||
| id1 | int | - | First number of new element |
| id2 | int | - | Second number of new element |
| id3 | int | - | Third number of new element |
| strid | String oder char* | - | StringID of new element |
static int elementlist::remove(ElementList li, Element val)
Remove the given ID from the list. The given ID will not released. Only the first occurence of the object will be effected.
| Name | Type | Default | Description |
| Return | int | 1 : Action successful 0 : otherwise |
|
| li | ElementList | - | list from which the remove is to be made |
| val | Element | - | Value which is to be removed from the list |
static Element elementlist::remove_pos(ElementList li, int pos)
Remove a position from the list. Positions are 0-based, the first element has the position 0, the final the position length-1. The removed object in not released automatically!
| Name | Type | Default | Description |
| Return | Element | Removed object or 0 | |
| li | ElementList | - | list |
| pos | int | - | 0-based delete position |
An entry removed from an ElementList with elementlist::remove_pos is not automatically deleted itself. The entry itself can be deleted with element::release. ATTENTION: Conversely, deleting an Element variable that is used in a list results in an undefined list object!
id = idtypelist::remove_pos (0); if (id) idtype::release (id);
static char* elementlist::to_xml(ElementList list, char* rootElementName = "elements")
Generate a XML structure of a ElementList object.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
| Name | Type | Default | Description |
| Return | char * | xml string or 0 on errors. The result string is valid until the next time a to_xml function is called and must not be changed or released. | |
| list | ElementList | - object | |
| rootElementName | String or char* | elements | name of the root element |
static ElementList elementlist::from_xml(char* xml)
Create a ElementList object from a xml structure.
If you think about using this function, you might be interested in further information about cscript / java interaction. Related information can be found here.
| Name | Type | Default | Description |
| Return | ElementList | object of type ElementList. This list must be released using elementlist::release. | |
| xml | String or char* | - | xml structure |
static int elementlist::add_all(
ElementList target,
ElementList src,
int deleteFromSource)
Append all elements from list src to list target. If deleteFromSource is non-zero, all elements are removed from source list. (but not deleted)
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode. | |
| target | ElementList - | target list | |
| src | ElementList - | source list | |
| deleteFromSource | int | 0 | delete elements from source |
static int elementlist::get_area_built_elements(ItemRef frameRef, ElementList target)
Get all elements built by an repeating element.
| Name | Type | Default | Description |
| Return | int | 0 or ErrorCode. | |
| frameRef | ItemRef | - | Frame of repeating element 0 : current script frame |
| target | ElementList | - | Allocated ElementList for the results. Thelist is cleared before. |
Here you will find an example.
-
Alphabetic index HTML hierarchy of classes or Java