XPSEDAPI
 All Classes Namespaces Files Functions Variables Typedefs
XPCOM::IObject Interface Reference

The object is the top-level object, from which anything which needs to get passed between modules should inherit. More...

Inheritance diagram for XPCOM::IObject:

Public Member Functions

void add_ref ()
 Called to indicate that some code is keeping an owning reference to the object.
oneway void release_ref ()
 Removes a reference to an object which was created by some other means (e.g.
IObject query_interface (in utf8string id)
 Returns an IObject of the same implementation, which supports a specific interface.

Public Attributes

readonly attribute string objid
 Fetches the ID of the object.

Detailed Description

The object is the top-level object, from which anything which needs to get passed between modules should inherit.

Definition at line 57 of file xpcom.idl.

Member Function Documentation

void XPCOM::IObject::add_ref ( )

Called to indicate that some code is keeping an owning reference to the object.

That code must call release_ref() later when it has finished with the object, or a memory leak may result. The object should be preserved in memory. Care should be taken to ensure that a cycle of objects waiting for each other to call release_ref is not created.

IObject XPCOM::IObject::query_interface ( in utf8string  id)

Returns an IObject of the same implementation, which supports a specific interface.

Parameters
idThe name of the interface, with each part of the scope separated by double colons. For example, "XPCOM::IObject".
Returns
A supporting IObject, or null if interface not supported. An implementation should support query_interface for all interfaces directly or indirectly (through inheritance) supported by that interface.
Note
This particular operation needs special treatment by bridges, because although the return type is XPCOM::IObject, the bridge is expected to look up the id and produce a bridge suitable for casting to the desired type. If the bridge cannot do this, because, for example, it doesn't know the interface, it should return null (since the bridges + implementation cannot support the desired interface).
oneway void XPCOM::IObject::release_ref ( )

Removes a reference to an object which was created by some other means (e.g.

by return from a function, out parameters, or add_ref). The object may destroy itself any time after no references remain.

Member Data Documentation

readonly attribute string XPCOM::IObject::objid

Fetches the ID of the object.

IDs should be generated in a way which makes the probability of a collision negligible. The recommended method is to use a random number generated seeded with a sufficient amount of data, and output data in this form %08X-%04X-%04X-%04X-%04X%08X (where %0nX represents a hex string of n digits padded to the left with zeros if needed). The id must never change once set.

Definition at line 102 of file xpcom.idl.