Function CDM_SetGetElements
|
|
Definition: | #include <CDM.h> |
---|
|
Prototype: | int CDM_SetGetElements(CDM_Set Set, int *objcPtr, CDM_Object **objvPtr);
|
---|
Arguments: | Set: The set whose elements will be placed in the array. (CDM_AttributeSet) objcPtr: A pointer to an integer, where the number of objects placed in the array will be saved. (int *) objvPtr: A location where the pointer to the array of objects will be stored. (CDM_Object **)
|
---|
|
|
Description:
This function returns a count and a pointer to an array of the elements
(object) in a set object (of type CDM_Set or CDM_AnnotationSet or
CDM_AttributeSet or CDM_ByteSequenceSet or CDM_RawDataSet or CDM_SpanSet).
It returns the count by storing it in the address pointed by the "objcPtr"
parameter (of type int *). Similarly, it returns the array pointer
by storing it in the address pointed by the "objvPtr" parameter (of type
CDM_Object ** or CDM_Annotation ** or
CDM_Attribute ** or CDM_ByteSequence ** or CDM_RawData ** or CDM_Span **).
The memory pointed to is managed by CDM and should
not be freed by the caller. In case of an error, TCL_ERROR will be returned and an error message will
be left in the current active Tcl interpreter (CDM_Interp).
Otherwise TCL_OK will be returned after storing the count and
array pointer.
Return Value:
This function returns a count and a pointer to an array of the elements
(objects) in an set object (of type CDM_Set).
It returns the count by storing it in the address pointed by the "objcPtr"
parameter (of type int *). Similarly, it returns the array pointer
by storing it in the address pointed by the "objvPtr" parameter (of type
CDM_Object **). The memory pointed to is managed by CDM and should
not be freed by the caller.
In case of an error, TCL_ERROR will be returned and an error message
describing the error will be left at the current Tcl interpreter
(CDM_Interp). Otherwise TCL_OK will be returned.
Notes:
Usage example:
int objc;
CDM_Attribute **objv;
CDM_AttributeSet set = CDM_GetAttributes(Doc);
int status = CDM_SetGetElements(set, objc, objv);
if (status != TCL_OK) {
// An error occured. What is the error message?
Tcl_interp *interp = CDM_GetActiveInterpreter();
if (interp) {
const char* msg = Tcl_GetStringResult(interp);
}
}
// Make an iteration over all Attributes...
for (int i = 0; i < objc, i++) {
// Now, objv[i] is an Attribute...
}
See Also:
CDM_AnnotationSetGetElements, CDM_AttributeSetGetElements,
CDM_SpanSetGetElements
Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.