Lists of objects of type Element

Lists of objects of type Element

static ElementList alloc()

Create a new empty list of type ElementList.

Name Type Default Description
Return ElementList   New ElementList.

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static Element 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
If setPos > 0, the current list position is located at pos.

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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

Version 4.1.0 R20008

priint:comet InDesign® Plug-Ins, comet_pdf

static Element 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
id	= idtypelist::remove_pos (0);
if (id) idtype::release (id);

Version 1.4.1 R 416, 18. Jul 2007 Version 4.1.0 R20008

priint:comet InDesign® Plug-Ins, comet_pdf

static char* 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

comet.publication.toXMLElementList

static 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

comet.publication.fromXMLElementList

static int 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

Version 4.1.0 R19232

priint:comet InDesign® Plug-Ins, comet_pdf

static int 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.

-

Version 4.1 R21400

priint:comet InDesign® Plug-Ins, comet_pdf

element::frames
element::masterframe
comet.CFrame.getBuiltElements

Since
Version 4.1.0 R19232
See Also
element

Alphabetic index HTML hierarchy of classes or Java