Functions to manage key value pairs

Functions to manage key value pairs

static KeyValues alloc()

Alloc a KeyValues list object

Name Type Default Description
Return KeyValues   new KeyValues object. This object must be released using keyvalues::release!
... String or char* - optional list of key value pairs to use for initialization
// create an empty KeyValues list:
KeyValues values = keyvalues::alloc ();
 
// create a KeyValues list with initial values:
KeyValues values2 = keyvalues::alloc ("key1", "value1", "key2", "value2");

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static KeyValues release(KeyValues list)

Delete a list created with keyvalues::alloc and all its entries from memory.

Name Type Default Description
Return int   0
list KeyValues - List to be deleted

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

clear

static int clear(KeyValues list)

Release a KeyValues list

Name Type Default Description
Return int   0 or error code
list KeyValues - KeyValues object

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

release

static int put(
  KeyValues list,
  char* key,
  char* value)

Add a key value entry to a list or replace an existing entry

Name Type Default Description
Return int   0 or error code
list KeyValues - KeyValues object
key String or char* - key of the entry
value String or char* - value of the entry

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* get(KeyValues list, char* key)

Get the value of an entry in a KeyValues list

Name Type Default Description
Return char *   value of the entry or 0, if the entry cannot be found. The result string must not be changed!
list KeyValues - KeyValues object
key String or char* - key of the entry

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* remove(KeyValues list, char* key)

Remove an entry from a KeyValues list

Name Type Default Description
Return char *   value of the removed entry or 0, if the entry cannot be found. The result string must not be changed!
list KeyValues - KeyValues object
key String or char* - key of the entry

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int contains(KeyValues list, char* key)

Check, if a particular entry exists in a KeyValues list

Name Type Default Description
Return int   1, if the entry exists, 0 otherwise
list KeyValues - KeyValues object
key String or char* - key of the entry

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int length(KeyValues list)

Get the length (number of entries) of a KeyValues list

Name Type Default Description
Return int   length (number of entries) of this list
list KeyValues - KeyValues object

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* to_xml(KeyValues list, char* rootElementName = "keyvalues")

Generate a XML structure of a KeyValues 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 KeyValues - object
rootElementName String or char* keyvalues name of the root element

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.publication.toXMLKeyValueList

static KeyValues from_xml(char* xml)

Create a KeyValues 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 KeyValues   object of type KeyValues. This list must be released using stringlist::release.
xml String or char* - xml structure

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

comet.publication.fromXMLKeyValueList

static int add_all(
  KeyValues target,
  KeyValues src,
  int deleteFromSource = 0)

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 oder Fehlercode.
target KeyValues - target list
src KeyValues - source list
deleteFromSource int 0 delete elements from source

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static StringList get_keys(KeyValues list)

Get all keys of a KeyValues list as a StringList. The entries in the list are in no particular order.

Name Type Default Description
Return StringList   StringList object. This list must be released using keyvalues::release()
target KeyValues - list

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static StringList get_values(KeyValues list)

Get all values of a KeyValues list as a StringList. The entries in the list are in no particular order.

Name Type Default Description
Return StringList   StringList object. This list must be released using keyvalues::release()
target KeyValues - list

Version 4.1 R21349

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

Alphabetic index HTML hierarchy of classes or Java