Open main menu

CDOT Wiki β

Changes

Real World Mozilla First XPCOM Component

18 bytes removed, 20:05, 27 February 2007
Module Code
In addition to implementing the module code (i.e., [http://developer.mozilla.org/en/docs/nsIModule nsIModule]), we also have to write code to allow our component to be created at runtime based on an interface rather than concrete types--essentially, abstracting the process of creation so that clients don't have to know about real classes underneath the interfaces. This means implementing the [http://developer.mozilla.org/en/docs/nsIFactory nsIFactory] interface.
Together, these two interfaces will require us to write hundreds lines of code (see [http://developer.mozilla.org/en/docs/Creating_XPCOM_Components:Creating_the_Component_Code#webLock1.cpp as an example)hundreds lines of code], the majority of which is generic boilerplate code. In order to simplify the work component developers must do, a number of macros help us with this task:
* NS_GENERIC_FACTORY_CONSTRUCTOR