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


nsIComponentRegistrar


This interface handles component registration and management.

Methods
autoRegister

Registers a component file or all component files in a directory. Component files must have an associated loader and export the required symbols which this loader defines. For example, if the given file is a native library (which is built into XPCOM), it must export the symbol NSGetModule. Other loaders may have different semantics.

This method may only be called from the main thread.

Syntax:

void nsIComponentRegistrar::autoRegister(
	in nsIFile aSpec) 

Parameters:

aSpec: Filename spec for component file's location. If aSpec is a directory, then every component file in the directory will be registered. If the aSpec is null, then the application component's directory as defined by NS_XPCOM_COMPONENT_DIR will be registered (see nsIDirectoryService.idl)

nsresult:

NS_OK if registration was successful.
NS_ERROR if not.
autoUnregister

Unregisters a component file or all component files in a directory.

This method may only be called from the main thread.

Syntax:

void nsIComponentRegistrar::autoUnregister(
	in nsIFile aSpec) 

Parameters:

aSpec: Filename spec for component file's location. If aSpec is a directory, then every component file in the directory will be unregistered. If aSpec is null, then the application component's directory as defined by NS_XPCOM_COMPONENT_DIR will be unregistered (see nsIDirectoryService.idl)

nsresult:

NS_OK if unregistration was successful.
NS_ERROR if not.
registerFactory

Registers a factory with a given ContractID, CID, and Class Name.

Syntax:

void nsIComponentRegistrar::registerFactory(
	in nsCIDRef aClass,in string aClassName,
	in string aContractID, in nsIFactory aFactory) 

Parameters:

aClass: The CID.
aClassName: The Class Name associated with aClass.
aContractID: The ContractID associated with aClass.
aFactory: The factory that will be registered for aClass.

nsresult:

NS_OK if registration was successful.
NS_ERROR if not.
unregisterFactory

Unregisters a factory associated with CID aClass.

Syntax:

void nsIComponentRegistrar::unregisterFactory(
	in nsCIDRef aClass, in nsIFactory aFactory) 

Parameters:

aClass: The CID being unregistered.
aFactory: The factory that will be unregistered for aClass.

nsresult:

NS_OK if unregistration was successful.
NS_ERROR if not.
registerFactoryLocation

Registers a factory with a given ContractID, CID and Class Name via location.

Syntax:

void nsIComponentRegistrar::registerFactoryLocation(
	in nsCIDRef aClass, in string aClassName,
	 in string aContractID, in nsIFile aFile,
	 in string aLoaderStr, in string aType) 

Parameters:

aClass: The CID of the class.
aClassName: The Class Name of aClass.
aContractID: The ContractID associated with aClass.
aFile: The Component File. This file must have an associated loader and export the required symbols which this loader specifies.
aLoaderStr: An opaque loader specific string. This value is passed into the nsIModule's registerSelf callback and must be fowarded unmodified when registering factories via their location.
aType: TheComponent Type of aClass. This value is passed into the nsIModule's registerSelf callback and must be fowarded unmodified when registering factories via their location.

nsresult:

NS_OK if registration was successful.
NS_ERROR if not.
unregisterFactoryLocation

Unregisters a factory associated with aClass via location.

Syntax:

void nsIComponentRegistrar::unregisterFactoryLocation(
	in nsCIDRef aClass, in nsIFile aFile) 

Parameters:

aClass: The CID being unregistered.
aFile: The Component File previously registered.

nsresult:

NS_OK if unregistration was successful.
NS_ERROR if not.
isCIDRegistered

Returns TRUE if a factory is registered for a CID.

Syntax:

boolean nsIComponentRegistrar::isCIDRegistered(
	in nsCIDRef aClass) 

Parameters:

aClass: The CID queried for registration.

Returns:

TRUE if a factory is registered for the CID.
FALSE if not.
isContractIDRegistered

Returns TRUE if a factory is registered for a ContractID.

Syntax:

boolean nsIComponentRegistrar::isContractIDRegistered(
	in string aContractID) 

Parameters:

aContractID: The ContractID queried for registration.

Returns:

TRUE if a factory is registered for the ContractID.
FALSE if not.
enumerateCIDs

Enumerates the list of all registered CIDs.

Syntax:

nsISimpleEnumerator nsIComponentRegistrar::enumerateCIDs() 

Parameters:

None.

Returns:

An enumerator for CIDs.
enumerateContractIDs

Enumerates the list of all registered ContractIDs.

Syntax:

nsISimpleEnumerator nsIComponentRegistrar::enumerateContractIDs() 

Parameters:

None.

Returns:

An enumerator for ContractIDs.
CIDToContractID

Gets the ContractID for a given CID, if one exists and is registered.

Syntax:

string nsIComponentRegistrar::CIDToContractID(
	in nsCIDRef aClass) 

Parameters:

aClass: The CID whose ContractID is being sought.

Returns:

The ContractID.
contractIDToCID

Gets the CID for a given Contract ID, if one exists and is registered.

Syntax:

nsCIDPtr nsIComponentRegistrar::contractIDToCID(
	in string aContractID) 

Parameters:

aContractID: The ContractID whose CID is being sought.

Returns:

The CID.

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