Function CDM_RemoveAttribute
|
|
Definition: | #include <CDM.h> |
---|
|
Prototype: | int CDM_RemoveAttribute(CDM_Collection Collection, char *Name);
|
---|
Arguments: | Collection: A Collection object. (CDM_Collection) Name: The Name of the Attribute to be removed. (char *)
|
---|
|
|
Prototype: | int CDM_RemoveAttribute(CDM_Document Document, char *Name);
|
---|
Arguments: | Document: A Document object. (CDM_Document) Name: The Name of the Attribute to be removed. (char *)
|
---|
|
|
Prototype: | CDM_Annotation CDM_RemoveAttribute(CDM_Annotation Annotation, char *Name);
|
---|
Arguments: | Ann: Annotation's Pointer (CDM_Annotation) Name: Attribute's name to be removed (char *)
|
---|
|
|
Description:
This function will remove the Attribute named exactly as the "Name"
parameter. If the requested Attribute does not exist, an error
condition will be returned. This function will remove the Attribute named exactly as the "Name"
parameter. If the requested Attribute does not exist, an error will be
returned. This function will remove the Attribute having as name the value of the
"Name" parameter from the specified Annotation, if such an Attribute
exists. 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_RemoveAttribute(ann, "pos");
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 the
requested Attribute exists and is successfully removed, then TCL_OK
will be returned. In case of an error, the return value will be
TCL_ERROR and an error message describing the error will be left at the
current Tcl interpreter (CDM_Interp). 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 the
requested Attribute exists and is successfully removed, then TCL_OK
will be returned. In case of an error, the return value will be
TCL_ERROR and an error message describing the error will be left at the
current Tcl interpreter (CDM_Interp). 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_RemoveAttribute (Tcl API). This function is equivelant to tip_RemoveAttribute (Tcl API). This function is equivelant to tip_RemoveAttribute (Tcl API).
See Also:
tip_RemoveAttribute tip_RemoveAttribute CDM_Free, tip_RemoveAttribute,
Tcl_IsShared,
Tcl_DecrRefCount
Generated by: petasis@aias on Wed Aug 16 10:31:57 PM EEST 2006.