DL Logo

CosName Functions

CosCopyNameStringValue

Header: CosProcs.h:2193

Description

Returns a newly allocated buffer containing a copy of the Cos object's name as a NULL-terminated string. Upon return, nBytes contains the number of bytes in the string. CosCopyNameStringValue() never returns NULL; it raises an exception if the allocation fails. The client is responsible for freeing the result by calling ASfree().

Unlike Cos strings, the strings corresponding to Cos names are NULL-terminated.

This routine will avoid creating an ASAtom corresponding to the object's name and is generally more efficient than copying the value returned by ASAtomGetString(CosNameValue(obj)). ( ASAtom objects consume global memory that is not deallocated.)

An out-of-memory exception is raised if insufficient memory is available.

Syntax

char *CosCopyNameStringValue(CosObj obj, ASTCount *nBytes);

Parameters

obj
IN A Cos name object.
nBytes
OUT The length of the name of the Cos object, and therefore the length of the returned string. nBytes may be NULL if you do not care how many bytes are in the name.

Returns

A copy of the Cos object's name, as a NULL-terminated string.

CosNameValue

Header: CosProcs.h:548

Description

Gets the value of a name object.

Syntax

ASAtom CosNameValue(CosObj obj);

Parameters

obj
The object of type CosName whose value is obtained.

Returns

The ASAtom corresponding to the specified name object. An ASAtom can be converted to a string using ASAtomGetString(). Note that CosCopyNameStringValue() can be used to obtain the name as a string, without creating an ASAtom ( ASAtom objects consume global memory that is not deallocated).

An exception is raised if obj has the wrong type, if storage is exhausted, or if file access fails.

CosNewName

Header: CosProcs.h:215

Description

Creates a new name object associated with the specified document and having the specified value.

Syntax

CosObj CosNewName(CosDoc dP, ASBool indirect, ASAtom name);

Parameters

dP
The document in which the new name is used.
indirect
If true, it creates the name as an indirect object, and sets the document's PDDocNeedsSave flag (see PDDocFlags) flag. If false, it creates the name as a direct object.
name
The ASAtom corresponding to the name to create. A C string can be converted to an ASAtom using ASAtomFromString(). Note that a name object can be created directly from a C string, without creating an ASAtom, by using CosNewNameFromString().

Returns

The newly created name Cos object.

CosNewNameFromString

Header: CosProcs.h:2162

Description

Creates a new name object associated with the specified document and having the specified value.

Syntax

CosObj CosNewNameFromString(CosDoc dP, ASBool indirect, const char *namestring);

Parameters

dP
The document in which the new name is used.
indirect
If true, it creates the name as an indirect object, and sets the document's PDDocNeedsSave flag (see PDDocFlags) flag. If false, it creates the name as a direct object.
namestring
The name to create. This routine will not create an ASAtom corresponding to namestring and is generally more efficient than CosNewName(). ( ASAtom objects consume global memory that is not deallocated.)

Returns

The newly created name Cos object.