You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.


TOC PREV NEXT INDEX

Embedding Gecko API


nsIFactory


A class factory allows the creation of nsISupports derived components without specifying a concrete base class. This interface is scriptable.

Methods
createInstance

Creates an instance of an object that implements the specified IID.

Syntax:

void nsIFactory::createInstance(in nsISupports aOuter,
	in nsIIDRef iid,
	[retval, iid_is(iid)] out nsQIResult result)  

Parameters:

aOuter: Pointer to a component that wishes to be aggregated in the resulting instance. This will be nsnull if no aggregation is requested.
iid: The IID of the interface being requested in the component which is being currently created.
result: [out] Pointer to the newly created instance, if successful.

nsresult:

NS_OK if the component was successfully created and the interface being requested was successfully returned in result.
NS_NOINTERFACE if the interface not accessible.
NS_ERROR_NO_AGGREGATION if an 'outer' object is supplied, but the component is not aggregatable.
NS_ERROR* if there is a method failure.
lockFactory

Provides the client a way to keep the component in memory until the client is finished with it. The client can call lockFactory(PR_TRUE) to lock the factory and lockFactory(PR_FALSE) to release the factory.

Syntax:

void nsIFactory::lockFactory(in PRBool lock)  

Parameters:

lock must be PR_TRUE or PR_FALSE

nsresult:

NS_OK if the lock operation was successful.
NS_ERROR* if there is a method failure.

Written by:Ellen Evans | Comments, questions, complaints? Bug 143387
TOC PREV NEXT INDEX