QComponentFactory Class Reference
The API for this class is under development and is subject to change.
We do not recommend the use of this class for production work at this time.
The QComponentFactory class provides static functions to create and register components.
More...
#include <qcomponentfactory.h>
List of all member functions.
Static Public Members
QRESULT
createInstance ( const QUuid & cid, const QUuid & iid, QUnknownInterface ** instance, QUnknownInterface * outer = 0 )
bool
registerComponent ( const QUuid & cid, const QString & filepath, const QString & description = QString::null )
Detailed Description
The QComponentFactory class provides static functions to create and register components.
The component factory provides convenience functions that can be
used both by applications to instantiate components, and by component
servers to register components.
The createInstance() function is used to obtain a pointer to an
interface.
Use registerServer() to load a shared library which provides the
QComponentServerInterface and register its components. Use
unregisterServer() to unregister a shared library's components.
registerComponent() and unregisterComponent() register and unregister
single components from the global component database, and can be used
by implementations of the QComponentServerInterface.
See also QComponentServerInterface and QComponentFactoryInterface.
Member Function Documentation
QRESULT QComponentFactory::createInstance ( const QUuid & cid, const QUuid & iid, QUnknownInterface ** instance, QUnknownInterface * outer = 0 ) [static]
Searches for the component identifier cid in the system registry,
loads the corresponding component server and queries for the interface iid. The parameter outer is a pointer to the outer interface used
for containment and aggregation and is propagated to the createInstance
implementation of the QComponentFactoryInterface provided by the
component server if provided.
Returns the retrieved interface pointer, or NULL if there was an error.
Example:
MyInterface *iface = (MyInterface*)QComponentFactory::createInstance( IID_MyInterface, CID_MyComponent );
if ( iface ) {
...
iface->release();
}
bool QComponentFactory::registerComponent ( const QUuid & cid, const QString & filepath, const QString & description = QString::null ) [static]
Registers the component with id cid in the global component database.
The component is registered with an optional description and is provided
by the server at filepath.
Call this function for each component in an implementation of
registerComponents.
See also unregisterComponent() and registerServer().
bool QComponentFactory::registerServer ( const QString & filename ) [static]
Loads the shared library filename and queries for a
QComponentServerInterface. If the library implements this interface,
the registerComponents function is called.
Returns TRUE if the interface is found and successfully registered,
otherwise returns FALSE.
bool QComponentFactory::unregisterComponent ( const QUuid & cid ) [static]
Unregisters the component with id cid from the global component database.
Call this function for each component in an implementation of
unregisterComponents.
See also registerComponent() and unregisterServer().
bool QComponentFactory::unregisterServer ( const QString & filename ) [static]
Loads the shared library filename and queries for a
QComponentServerInterface. If the library implements this interface,
the unregisterComponents function is called.
Returns TRUE if the interface is found and successfully unregistered,
otherwise returns FALSE.
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit,
copyright © 1995-2001
Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks
| Qt version 3.0.0-beta1-beta1
|