Next: , Previous: , Up: C   [Index]


Attributes

Object Attributes

The Ctalk API defines a number of object attributes. The attributes help identify the context that the object appears in. Many of the attributes are only meaningful internally; some are also useful in the method API.

The attributes are defined in ctalkdefs.h, which you can include in class libraries. To set an object’s attribute, it’s generally convenient to use the __ctalkSetObjectAttr () library function, which has the prototype:


__ctalkSetObjectAttr (OBJECT *object, int attr)

Many attributes are only used by Ctalk internally. The attributes that are useful in methods are defined in ctalkdefs.h. Those attributes, and their values and uses, are listed here.

OBJECT_IS_VALUE_VAR (1 << 0)

The object is the value instance variable of its parent object.

OBJECT_VALUE_IS_C_CHAR_PTR_PTR (1 << 1)

Used to indicate that an object refers to a char ** C array.

OBJECT_IS_NULL_RESULT_OBJECT (1 << 2)

Indentifies an object that is created when an operation produces a NULL result.

OBJECT_HAS_PTR_CX (1 << 3)

Set when an object appears on the left-hand side of an equation with a pointer reference; e.g.,


*mySymbol = __ctalk_self_internal ().

OBJECT_IS_GLOBAL_COPY (1 << 4)

Set when a program copies a global object.

OBJECT_IS_I_RESULT (1 << 5)

Identifies temporary objects that are the result of an operation that sets the object tag’s pointer references.

OBJECT_IS_STRING_LITERAL (1 << 6)

Used to identify an object created to represent a string literal.

OBJECT_IS_MEMBER_OF_PARENT_COLLECTION (1 << 7)

Indicates that an object (generally a Key object) is a member of a parent collection. Normally used to identify individual collection members.

OBJECT_HAS_LOCAL_TAG (1 << 8)

Indicates that an object’s tag was created as a placeholder for an ad-hoc object; for example, objects created by a basicNew method. The local tag is not necessarily the primary tag - the object can also acquire other tags when being assigned. Normally this attribute is set by the __ctalkAddBasicNewTag () library function.

OBJECT_IS_DEREF_RESULT

Set by the Object : -> method. The attribute is used to indicate that the receiver of -> is the result of a previous call to ->; i.e., the expression contains several dereference operators; for example, ‘myObject -> instancevars -> __o_value’.


Next: , Previous: , Up: C   [Index]