Function CDM_PutAttribute
|
|
|
|
Description:
This function will add a given Attribute to the specified Collection
object. If an Attribute with the same name already exists in the
Collection, then it will be overwritten by the new Attribute. Else, the
new Attribute will be appended to the existing Attribute set of the
specified Collection. This function will add a given Attribute to the specified Document
object. If an Attribute with the same name already exists in the
Document, then it will be overwritten by the new Attribute. Else, the
new Attribute will be appended to the existing Attribute set of the
specified Document. This function will add a given Attribute to the specified Annotation
object. If an Attribute with the same name already exists in the
Annotation, then it will be overwritten by the new Attribute. Else, the
new Attribute will be appended to the existing Attribute set of the
specified Annotation. The returned value of this function may be a new Annotation
object or the provided one. What the result will be depends on whether
the provided Annotation is a shared object or not. If the provided
Annotation is a shared object (i.e.
Tcl_IsShared returns true)
a new Annotation object will be created and returned, since a shared
object cannot be modified. If the provided Annotation is not a shared
object, then the required changes will be done in place, and the same
Annotation object will be returned.
As a result, the caller should be always check the returned value, if he
is the owner but does not want to keep the initial Annotation object.
A typical use is shown in the following code:
ann = CDM_CreateAnnotation("token", spanset, attrset);
new_ann = CDM_PutAttribute(ann, Attr);
if (new_ann != ann) {
CDM_Free(ann);
ann = new_ann;
}
CDM_AddAnnotation(Doc, ann); // Now CDM is the owner, we can forget about it...
Return Value:
The return value from this function will be a standart Tcl completion
code (of type int) with one of the values TCL_OK and TCL_ERROR. If an
error occurs, the return value will be TCL_ERROR and an error message
describing the error will be left at the current Tcl interpreter
(CDM_Interp). Else, TCL_OK will be returned. The return value from this function will be a standart Tcl completion
code (of type int) with one of the values TCL_OK and TCL_ERROR. If an
error occurs, the return value will be TCL_ERROR and an error message
describing the error will be left at the current Tcl interpreter
(CDM_Interp). Else, TCL_OK will be returned. This function will return an Annotation object (of type CDM_Annotation).
The returned value of this function may be a new Annotation
object or the provided one. What the result will be depends on whether
the provided Annotation is a shared object or not. If the provided
Annotation is a shared object (i.e.
Tcl_IsShared returns true)
a new Annotation object will be created and returned, since a shared
object cannot be modified. If the provided Annotation is not a shared
object, then the required changes will be done in place, and the same
Annotation object will be returned.
Notes:
This function is equivelant to tip_PutAttribute (Tcl API). This function is equivelant to tip_PutAttribute (Tcl API). This function is equivelant to tip_PutAttribute (Tcl API).
See Also:
tip_PutAttribute tip_PutAttribute CDM_GetAttribute, CDM_GetAttributes, tip_PutAttribute
Tcl_IsShared,
Tcl_DecrRefCount
Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.